Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.8% → 78.6%
Time: 25.7s
Alternatives: 26
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 26 alternatives:

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

Initial Program: 65.8% 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: 78.6% accurate, 0.8× speedup?

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

\mathbf{elif}\;h \leq -8.5 \cdot 10^{-86}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot t\_3\right)\\

\mathbf{elif}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_2\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if h < -2e143 or -8.499999999999999e-86 < h < -3.999999999999988e-310

    1. Initial program 54.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. Simplified54.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 46.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*46.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-146.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-neg46.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-in46.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. Simplified60.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. div-inv60.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e143 < h < -8.499999999999999e-86

    1. Initial program 63.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. Simplified66.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 48.6%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-h\right) \cdot \left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell}\right) + \left(-h\right) \cdot \left(-\frac{1}{h}\right)\right)}\right) \]
    6. Simplified71.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. frac-2neg65.9%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-\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) \]
      2. sqrt-div76.8%

        \[\leadsto \color{blue}{\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) \]
    8. Applied egg-rr88.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 -3.999999999999988e-310 < h < 6.0000000000000003e125

    1. Initial program 75.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. Simplified76.6%

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

        \[\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-unprod67.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-rr67.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. unpow167.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. Simplified67.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) \]
    8. Taylor expanded in M around 0 40.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr67.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow267.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.0000000000000003e125 < h

    1. Initial program 53.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. Simplified53.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 44.2%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-h\right) \cdot \left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell}\right) + \left(-h\right) \cdot \left(-\frac{1}{h}\right)\right)}\right) \]
    6. Simplified61.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{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) + 1\right)}\right) \]
    7. Step-by-step derivation
      1. sqrt-div81.8%

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

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

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

Alternative 2: 75.5% accurate, 0.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #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)))) < 2.0000000000000001e299

    1. Initial program 84.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. Simplified86.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 60.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*60.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-160.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-neg60.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-in60.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. Simplified87.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) \]

    if 2.0000000000000001e299 < (*.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 17.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. Simplified17.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified34.3%

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt32.2%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/32.3%

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

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg32.2%

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

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod26.7%

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

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv18.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. add-sqr-sqrt18.9%

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)}} \]
      15. rem-sqrt-square18.9%

        \[\leadsto \color{blue}{\left|\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right|} \]
    13. Applied egg-rr59.0%

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

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

Alternative 3: 80.0% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 51.0%

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

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

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\color{blue}{\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) \]
      2. sqrt-div68.9%

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-\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) \]
      2. sqrt-div77.1%

        \[\leadsto \color{blue}{\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) \]
    7. Applied egg-rr77.1%

      \[\leadsto \color{blue}{\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) \]

    if -8e-79 < l < -1.999999999999994e-310

    1. Initial program 70.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.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 67.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*67.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-167.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-neg67.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-in67.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. Simplified85.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-2neg72.0%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-\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) \]
      2. sqrt-div78.5%

        \[\leadsto \color{blue}{\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) \]
    8. Applied egg-rr98.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) \]

    if -1.999999999999994e-310 < l

    1. Initial program 69.9%

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around -inf 47.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*47.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-147.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-neg47.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-in47.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. Simplified72.9%

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

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

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

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

Alternative 4: 78.5% accurate, 0.8× speedup?

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

\mathbf{elif}\;h \leq -1.4 \cdot 10^{-71}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot t\_4\right)\\

\mathbf{elif}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;h \leq 4.8 \cdot 10^{+127}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(t\_3 \cdot -0.125\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if h < -2.20000000000000014e143 or -1.4e-71 < h < -3.999999999999988e-310

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.20000000000000014e143 < h < -1.4e-71

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around -inf 44.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*44.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-144.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-neg44.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-in44.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. Simplified69.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. frac-2neg63.5%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-\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) \]
      2. sqrt-div75.2%

        \[\leadsto \color{blue}{\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) \]
    8. Applied egg-rr87.4%

      \[\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 -3.999999999999988e-310 < h < 4.8000000000000004e127

    1. Initial program 75.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. Simplified76.6%

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

        \[\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-unprod67.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-rr67.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. unpow167.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. Simplified67.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) \]
    8. Taylor expanded in M around 0 40.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr67.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow267.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.8000000000000004e127 < h

    1. Initial program 53.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. Simplified53.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 44.2%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-h\right) \cdot \left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell}\right) + \left(-h\right) \cdot \left(-\frac{1}{h}\right)\right)}\right) \]
    6. Simplified61.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{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) + 1\right)}\right) \]
    7. Step-by-step derivation
      1. sqrt-div81.8%

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

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

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

Alternative 5: 76.2% accurate, 0.8× speedup?

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

\mathbf{elif}\;h \leq -4.5 \cdot 10^{-303}:\\
\;\;\;\;\left(\frac{t\_1}{\sqrt{-h}} \cdot t\_3\right) \cdot \left(1 - 0.125 \cdot \left(\frac{h}{\ell} \cdot t\_2\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if h < -6.99999999999999995e-76

    1. Initial program 52.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. Simplified54.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-\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) \]
      2. sqrt-div73.6%

        \[\leadsto \color{blue}{\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) \]
    12. Applied egg-rr72.4%

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

    if -6.99999999999999995e-76 < h < -4.5000000000000001e-303

    1. Initial program 74.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. Simplified74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr62.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow262.6%

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

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

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

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

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

    if -4.5000000000000001e-303 < h < 6.0000000000000003e125

    1. Initial program 74.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. Simplified75.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. pow175.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-unprod66.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr66.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow266.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.0000000000000003e125 < h

    1. Initial program 53.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. Simplified53.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 44.2%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-h\right) \cdot \left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell}\right) + \left(-h\right) \cdot \left(-\frac{1}{h}\right)\right)}\right) \]
    6. Simplified61.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{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) + 1\right)}\right) \]
    7. Step-by-step derivation
      1. sqrt-div81.8%

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

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

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

Alternative 6: 77.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 55.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. Simplified57.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 42.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*42.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-142.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-neg42.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-in42.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. Simplified61.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.5500000000000001e-184 < l < -1.999999999999994e-310

    1. Initial program 66.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.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 63.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*63.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-163.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-neg63.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-in63.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. Simplified79.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. pow179.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-\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) \]
      2. sqrt-div76.4%

        \[\leadsto \color{blue}{\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) \]
    12. Applied egg-rr98.0%

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

    if -1.999999999999994e-310 < l

    1. Initial program 69.9%

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around -inf 47.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*47.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-147.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-neg47.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-in47.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. Simplified72.9%

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

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

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

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

Alternative 7: 76.0% accurate, 0.8× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-\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) \]
      2. sqrt-div77.6%

        \[\leadsto \color{blue}{\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) \]
    12. Applied egg-rr73.4%

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

    if -3.999999999999988e-310 < h < 6.39999999999999967e125

    1. Initial program 75.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. Simplified76.6%

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

        \[\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-unprod67.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-rr67.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. unpow167.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. Simplified67.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) \]
    8. Taylor expanded in M around 0 40.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr67.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow267.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.39999999999999967e125 < h

    1. Initial program 53.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. Simplified53.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 44.2%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-h\right) \cdot \left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell}\right) + \left(-h\right) \cdot \left(-\frac{1}{h}\right)\right)}\right) \]
    6. Simplified61.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{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) + 1\right)}\right) \]
    7. Step-by-step derivation
      1. sqrt-div81.8%

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

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

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

Alternative 8: 72.5% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ t_1 := {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\\ t_2 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{t\_1 \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\ \mathbf{if}\;d \leq -3.6 \cdot 10^{+159}:\\ \;\;\;\;t\_0 \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-106}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;d \leq -8.5 \cdot 10^{-308}:\\ \;\;\;\;t\_0 \cdot \left(0.125 \cdot \left(\frac{h}{\ell} \cdot t\_1\right) + -1\right)\\ \mathbf{elif}\;d \leq 6.6 \cdot 10^{-155}:\\ \;\;\;\;d \cdot \frac{\mathsf{fma}\left(t\_1 \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell \cdot h}}\\ \mathbf{elif}\;d \leq 4.1 \cdot 10^{+113}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0 (* d (sqrt (/ 1.0 (* l h)))))
        (t_1 (pow (* D (/ M_m d)) 2.0))
        (t_2
         (*
          (sqrt (/ d h))
          (* (sqrt (/ d l)) (+ 1.0 (/ (* t_1 (* h -0.125)) l))))))
   (if (<= d -3.6e+159)
     (* t_0 (+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
     (if (<= d -4.4e-106)
       t_2
       (if (<= d -8.5e-308)
         (* t_0 (+ (* 0.125 (* (/ h l) t_1)) -1.0))
         (if (<= d 6.6e-155)
           (* d (/ (fma (* t_1 0.25) (* (/ h l) -0.5) 1.0) (sqrt (* l h))))
           (if (<= d 4.1e+113) t_2 (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double t_0 = d * sqrt((1.0 / (l * h)));
	double t_1 = pow((D * (M_m / d)), 2.0);
	double t_2 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((t_1 * (h * -0.125)) / l)));
	double tmp;
	if (d <= -3.6e+159) {
		tmp = t_0 * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))));
	} else if (d <= -4.4e-106) {
		tmp = t_2;
	} else if (d <= -8.5e-308) {
		tmp = t_0 * ((0.125 * ((h / l) * t_1)) + -1.0);
	} else if (d <= 6.6e-155) {
		tmp = d * (fma((t_1 * 0.25), ((h / l) * -0.5), 1.0) / sqrt((l * h)));
	} else if (d <= 4.1e+113) {
		tmp = t_2;
	} else {
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	t_0 = Float64(d * sqrt(Float64(1.0 / Float64(l * h))))
	t_1 = Float64(D * Float64(M_m / d)) ^ 2.0
	t_2 = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(t_1 * Float64(h * -0.125)) / l))))
	tmp = 0.0
	if (d <= -3.6e+159)
		tmp = Float64(t_0 * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))));
	elseif (d <= -4.4e-106)
		tmp = t_2;
	elseif (d <= -8.5e-308)
		tmp = Float64(t_0 * Float64(Float64(0.125 * Float64(Float64(h / l) * t_1)) + -1.0));
	elseif (d <= 6.6e-155)
		tmp = Float64(d * Float64(fma(Float64(t_1 * 0.25), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(Float64(l * h))));
	elseif (d <= 4.1e+113)
		tmp = t_2;
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(t$95$1 * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.6e+159], N[(t$95$0 * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.4e-106], t$95$2, If[LessEqual[d, -8.5e-308], N[(t$95$0 * N[(N[(0.125 * N[(N[(h / l), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.6e-155], N[(d * N[(N[(N[(t$95$1 * 0.25), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.1e+113], t$95$2, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
t_1 := {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\\
t_2 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{t\_1 \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
\mathbf{if}\;d \leq -3.6 \cdot 10^{+159}:\\
\;\;\;\;t\_0 \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\

\mathbf{elif}\;d \leq -4.4 \cdot 10^{-106}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;d \leq 6.6 \cdot 10^{-155}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(t\_1 \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell \cdot h}}\\

\mathbf{elif}\;d \leq 4.1 \cdot 10^{+113}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -3.60000000000000037e159

    1. Initial program 55.0%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}^{1}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. sqrt-unprod51.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-rr51.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. unpow151.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) \]
      2. associate-*l/43.1%

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

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

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

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

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

    if -3.60000000000000037e159 < d < -4.39999999999999989e-106 or 6.59999999999999972e-155 < d < 4.09999999999999993e113

    1. Initial program 78.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. Simplified78.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 60.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*60.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-160.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-neg60.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-in60.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. Simplified86.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. Step-by-step derivation
      1. pow186.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.39999999999999989e-106 < d < -8.49999999999999972e-308

    1. Initial program 40.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. Simplified42.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. pow142.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-unprod32.2%

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

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

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

      \[\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) \]
    8. Taylor expanded in M around 0 22.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr32.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow232.2%

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

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

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

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

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

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

    if -8.49999999999999972e-308 < d < 6.59999999999999972e-155

    1. Initial program 44.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. Simplified44.3%

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

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

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

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

        \[\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) \]
      2. associate-*l/28.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.09999999999999993e113 < d

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.6 \cdot 10^{+159}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-106}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -8.5 \cdot 10^{-308}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) + -1\right)\\ \mathbf{elif}\;d \leq 6.6 \cdot 10^{-155}:\\ \;\;\;\;d \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell \cdot h}}\\ \mathbf{elif}\;d \leq 4.1 \cdot 10^{+113}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 74.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 55.0%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}^{1}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. sqrt-unprod51.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-rr51.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. unpow151.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) \]
      2. associate-*l/43.1%

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

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

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

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

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

    if -8.6e158 < d < -8.79999999999999977e-106

    1. Initial program 71.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. Simplified71.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 62.2%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-h\right) \cdot \left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell}\right) + \left(-h\right) \cdot \left(-\frac{1}{h}\right)\right)}\right) \]
    6. Simplified83.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. pow183.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.79999999999999977e-106 < d < -8.49999999999999972e-308

    1. Initial program 40.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. Simplified42.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. pow142.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-unprod32.2%

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

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

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

      \[\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) \]
    8. Taylor expanded in M around 0 22.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr32.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow232.2%

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

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

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

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

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

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

    if -8.49999999999999972e-308 < d

    1. Initial program 69.3%

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

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

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

        \[\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) \]
      2. associate-*l/59.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{{d}^{2}}{\ell}}}{\sqrt{h}}} \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-div60.5%

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

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

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

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

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

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

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

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

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

Alternative 10: 69.0% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -9.2 \cdot 10^{+130}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\ \mathbf{elif}\;h \leq -4.5 \cdot 10^{-303}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M\_m}{d}\right)}^{2} \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= h -9.2e+130)
   (*
    (sqrt (* (/ d h) (/ d l)))
    (- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* M_m 0.5)) 2.0)) l))))
   (if (<= h -4.5e-303)
     (*
      (* d (sqrt (/ 1.0 (* l h))))
      (+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
     (*
      d
      (/
       (fma (* (pow (* D (/ M_m d)) 2.0) 0.25) (* (/ h l) -0.5) 1.0)
       (sqrt (* l h)))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -9.2e+130) {
		tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
	} else if (h <= -4.5e-303) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))));
	} else {
		tmp = d * (fma((pow((D * (M_m / d)), 2.0) * 0.25), ((h / l) * -0.5), 1.0) / sqrt((l * h)));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (h <= -9.2e+130)
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / l))));
	elseif (h <= -4.5e-303)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))));
	else
		tmp = Float64(d * Float64(fma(Float64((Float64(D * Float64(M_m / d)) ^ 2.0) * 0.25), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(Float64(l * h))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -9.2e+130], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4.5e-303], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -9.2 \cdot 10^{+130}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\

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

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


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

    1. Initial program 40.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. Simplified40.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. pow140.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-unprod28.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-rr28.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. unpow128.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. Simplified28.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) \]
    8. Step-by-step derivation
      1. associate-*r/43.9%

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

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

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

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

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

    if -9.20000000000000085e130 < h < -4.5000000000000001e-303

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

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

    if -4.5000000000000001e-303 < h

    1. Initial program 69.3%

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

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

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

        \[\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) \]
      2. associate-*l/59.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 57.4% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;d \leq -7.2 \cdot 10^{+118}:\\ \;\;\;\;\left|t\_0\right|\\ \mathbf{elif}\;d \leq -1.5 \cdot 10^{-77}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-311}:\\ \;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M\_m \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0 (/ d (sqrt (* l h)))))
   (if (<= d -7.2e+118)
     (fabs t_0)
     (if (<= d -1.5e-77)
       (/ (sqrt (/ d l)) (sqrt (/ h d)))
       (if (<= d -4e-311)
         (* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
         (* t_0 (+ 1.0 (* (/ h l) (* (pow (* M_m (/ D d)) 2.0) -0.125)))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double t_0 = d / sqrt((l * h));
	double tmp;
	if (d <= -7.2e+118) {
		tmp = fabs(t_0);
	} else if (d <= -1.5e-77) {
		tmp = sqrt((d / l)) / sqrt((h / d));
	} else if (d <= -4e-311) {
		tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
	} else {
		tmp = t_0 * (1.0 + ((h / l) * (pow((M_m * (D / d)), 2.0) * -0.125)));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	t_0 = Float64(d / sqrt(Float64(l * h)))
	tmp = 0.0
	if (d <= -7.2e+118)
		tmp = abs(t_0);
	elseif (d <= -1.5e-77)
		tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d)));
	elseif (d <= -4e-311)
		tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5));
	else
		tmp = Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) * -0.125))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.2e+118], N[Abs[t$95$0], $MachinePrecision], If[LessEqual[d, -1.5e-77], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-311], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;d \leq -7.2 \cdot 10^{+118}:\\
\;\;\;\;\left|t\_0\right|\\

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

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

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


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

    1. Initial program 54.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. Simplified57.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified1.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt0.2%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt22.8%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/22.8%

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

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg22.8%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
      9. frac-times41.3%

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv64.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. add-sqr-sqrt64.8%

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)}} \]
      15. rem-sqrt-square64.9%

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

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

    if -7.2e118 < d < -1.50000000000000008e-77

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified6.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt0.6%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt40.7%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/40.7%

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

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg40.7%

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

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod56.7%

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

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv56.7%

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

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}} \]
      14. clear-num56.6%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{1}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      15. un-div-inv56.7%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      16. sqrt-undiv56.8%

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

        \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\color{blue}{\frac{h}{d}}}} \]
    13. Applied egg-rr56.8%

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

    if -1.50000000000000008e-77 < d < -3.99999999999979e-311

    1. Initial program 45.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. Simplified47.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 14.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999979e-311 < d

    1. Initial program 69.9%

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

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

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

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

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

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

      \[\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) \]
    8. Taylor expanded in M around 0 37.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr60.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow260.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 68.2% accurate, 1.4× speedup?

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

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

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


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

    1. Initial program 40.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. Simplified40.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. pow140.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-unprod28.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-rr28.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. unpow128.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. Simplified28.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) \]
    8. Step-by-step derivation
      1. associate-*r/43.9%

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

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

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

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

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

    if -1.3e131 < h < -4.5000000000000001e-303

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

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

    if -4.5000000000000001e-303 < h

    1. Initial program 69.3%

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

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

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

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

      \[\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) \]
    8. Taylor expanded in M around 0 37.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr59.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow259.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 63.1% accurate, 1.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.86000000000000008e155

    1. Initial program 52.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. Simplified56.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 0.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified0.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt0.3%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt16.6%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/16.6%

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

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg16.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. add-sqr-sqrt67.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}}} \]
      14. sqrt-prod40.3%

        \[\leadsto \color{blue}{\sqrt{\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)}} \]
      15. rem-sqrt-square67.2%

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

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

    if -1.86000000000000008e155 < d < -5.3e-285

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

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

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

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

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

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

      \[\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) \]
    8. Step-by-step derivation
      1. associate-*r/56.7%

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

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

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

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

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

    if -5.3e-285 < d

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{\left({M}^{2} \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      6. unpow237.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\color{blue}{\left(M \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      7. unpow237.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      8. unpow237.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      9. times-frac43.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr57.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow257.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{{\left(M \cdot \frac{D}{d}\right)}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      12. associate-*r/57.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      13. *-commutative57.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      14. associate-/l*57.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(D \cdot \frac{M}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
    10. Simplified57.9%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125}\right) \]
    11. Step-by-step derivation
      1. pow157.9%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right)\right)}^{1}} \]
      2. *-commutative57.9%

        \[\leadsto {\color{blue}{\left(\left(1 - \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}}^{1} \]
      3. associate-*l*57.9%

        \[\leadsto {\left(\left(1 - \color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}^{1} \]
      4. frac-times48.9%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right)}^{1} \]
      5. sqrt-div52.9%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}}\right)}^{1} \]
      6. sqrt-unprod75.9%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right)}^{1} \]
      7. add-sqr-sqrt76.2%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right)}^{1} \]
    12. Applied egg-rr76.2%

      \[\leadsto \color{blue}{{\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    13. Step-by-step derivation
      1. unpow176.2%

        \[\leadsto \color{blue}{\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}} \]
      2. *-commutative76.2%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right)} \]
      3. sub-neg76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \color{blue}{\left(1 + \left(-{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right)\right)} \]
      4. distribute-rgt-neg-in76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(-\frac{h}{\ell} \cdot 0.125\right)}\right) \]
      5. *-commutative76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(-\color{blue}{0.125 \cdot \frac{h}{\ell}}\right)\right) \]
      6. distribute-lft-neg-in76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \color{blue}{\left(\left(-0.125\right) \cdot \frac{h}{\ell}\right)}\right) \]
      7. metadata-eval76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\color{blue}{-0.125} \cdot \frac{h}{\ell}\right)\right) \]
      8. associate-*r*76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right) \cdot \frac{h}{\ell}}\right) \]
      9. *-commutative76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \color{blue}{\frac{h}{\ell} \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right)}\right) \]
      10. *-commutative76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \color{blue}{\left(-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)}\right) \]
      11. associate-*r/75.4%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\color{blue}{\left(\frac{D \cdot M}{d}\right)}}^{2}\right)\right) \]
      12. *-commutative75.4%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(\frac{\color{blue}{M \cdot D}}{d}\right)}^{2}\right)\right) \]
      13. associate-/l*76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\color{blue}{\left(M \cdot \frac{D}{d}\right)}}^{2}\right)\right) \]
    14. Simplified76.2%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification68.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.86 \cdot 10^{+155}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;d \leq -5.3 \cdot 10^{-285}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 68.4% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -8.8 \cdot 10^{+129}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\ \mathbf{elif}\;h \leq -4.5 \cdot 10^{-303}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M\_m \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= h -8.8e+129)
   (*
    (sqrt (* (/ d h) (/ d l)))
    (- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* M_m 0.5)) 2.0)) l))))
   (if (<= h -4.5e-303)
     (*
      (* d (sqrt (/ 1.0 (* l h))))
      (+ (* 0.125 (* (/ h l) (pow (* D (/ M_m d)) 2.0))) -1.0))
     (*
      (/ d (sqrt (* l h)))
      (+ 1.0 (* (/ h l) (* (pow (* M_m (/ D d)) 2.0) -0.125)))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -8.8e+129) {
		tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
	} else if (h <= -4.5e-303) {
		tmp = (d * sqrt((1.0 / (l * h)))) * ((0.125 * ((h / l) * pow((D * (M_m / d)), 2.0))) + -1.0);
	} else {
		tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (pow((M_m * (D / d)), 2.0) * -0.125)));
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (h <= (-8.8d+129)) then
        tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.5d0 * ((h * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0)) / l)))
    else if (h <= (-4.5d-303)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * ((0.125d0 * ((h / l) * ((d_1 * (m_m / d)) ** 2.0d0))) + (-1.0d0))
    else
        tmp = (d / sqrt((l * h))) * (1.0d0 + ((h / l) * (((m_m * (d_1 / d)) ** 2.0d0) * (-0.125d0))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -8.8e+129) {
		tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * Math.pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
	} else if (h <= -4.5e-303) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * ((0.125 * ((h / l) * Math.pow((D * (M_m / d)), 2.0))) + -1.0);
	} else {
		tmp = (d / Math.sqrt((l * h))) * (1.0 + ((h / l) * (Math.pow((M_m * (D / d)), 2.0) * -0.125)));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if h <= -8.8e+129:
		tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * math.pow(((D / d) * (M_m * 0.5)), 2.0)) / l)))
	elif h <= -4.5e-303:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * ((0.125 * ((h / l) * math.pow((D * (M_m / d)), 2.0))) + -1.0)
	else:
		tmp = (d / math.sqrt((l * h))) * (1.0 + ((h / l) * (math.pow((M_m * (D / d)), 2.0) * -0.125)))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (h <= -8.8e+129)
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / l))));
	elseif (h <= -4.5e-303)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(0.125 * Float64(Float64(h / l) * (Float64(D * Float64(M_m / d)) ^ 2.0))) + -1.0));
	else
		tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) * -0.125))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (h <= -8.8e+129)
		tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * (((D / d) * (M_m * 0.5)) ^ 2.0)) / l)));
	elseif (h <= -4.5e-303)
		tmp = (d * sqrt((1.0 / (l * h)))) * ((0.125 * ((h / l) * ((D * (M_m / d)) ^ 2.0))) + -1.0);
	else
		tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (((M_m * (D / d)) ^ 2.0) * -0.125)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -8.8e+129], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4.5e-303], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -8.8 \cdot 10^{+129}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\

\mathbf{elif}\;h \leq -4.5 \cdot 10^{-303}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right) + -1\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M\_m \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -8.7999999999999997e129

    1. Initial program 40.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. Simplified40.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. pow140.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-unprod28.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-rr28.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. unpow128.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. Simplified28.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) \]
    8. Step-by-step derivation
      1. associate-*r/43.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
      2. *-commutative43.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{2} \cdot h}{\ell}\right) \]
      3. div-inv43.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{{\left(\frac{D}{d} \cdot \color{blue}{\left(M \cdot \frac{1}{2}\right)}\right)}^{2} \cdot h}{\ell}\right) \]
      4. metadata-eval43.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{{\left(\frac{D}{d} \cdot \left(M \cdot \color{blue}{0.5}\right)\right)}^{2} \cdot h}{\ell}\right) \]
    9. Applied egg-rr43.9%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2} \cdot h}{\ell}}\right) \]

    if -8.7999999999999997e129 < h < -4.5000000000000001e-303

    1. Initial program 67.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified69.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. pow169.9%

        \[\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-unprod56.9%

        \[\leadsto {\color{blue}{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}}^{1} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr56.9%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}^{1}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. unpow156.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Simplified56.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    8. Taylor expanded in M around 0 43.3%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
    9. Step-by-step derivation
      1. *-commutative43.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.125}\right) \]
      2. associate-*r*43.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      3. times-frac44.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)} \cdot 0.125\right) \]
      4. *-commutative44.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      5. associate-/l*44.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{\left({M}^{2} \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      6. unpow244.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\color{blue}{\left(M \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      7. unpow244.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      8. unpow244.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      9. times-frac51.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr56.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow256.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{{\left(M \cdot \frac{D}{d}\right)}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      12. associate-*r/55.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      13. *-commutative55.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      14. associate-/l*56.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(D \cdot \frac{M}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
    10. Simplified56.9%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125}\right) \]
    11. Taylor expanded in d around -inf 74.7%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \cdot \left(1 - \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]

    if -4.5000000000000001e-303 < h

    1. Initial program 69.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.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. pow170.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-unprod59.7%

        \[\leadsto {\color{blue}{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}}^{1} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr59.7%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}^{1}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. unpow159.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Simplified59.7%

      \[\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) \]
    8. Taylor expanded in M around 0 37.3%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
    9. Step-by-step derivation
      1. *-commutative37.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.125}\right) \]
      2. associate-*r*38.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      3. times-frac38.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)} \cdot 0.125\right) \]
      4. *-commutative38.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      5. associate-/l*38.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{\left({M}^{2} \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      6. unpow238.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\color{blue}{\left(M \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      7. unpow238.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      8. unpow238.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      9. times-frac44.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr59.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow259.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{{\left(M \cdot \frac{D}{d}\right)}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      12. associate-*r/58.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      13. *-commutative58.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      14. associate-/l*59.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(D \cdot \frac{M}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
    10. Simplified59.7%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125}\right) \]
    11. Step-by-step derivation
      1. pow159.7%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right)\right)}^{1}} \]
      2. *-commutative59.7%

        \[\leadsto {\color{blue}{\left(\left(1 - \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}}^{1} \]
      3. associate-*l*59.7%

        \[\leadsto {\left(\left(1 - \color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}^{1} \]
      4. frac-times50.4%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right)}^{1} \]
      5. sqrt-div54.5%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}}\right)}^{1} \]
      6. sqrt-unprod78.3%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right)}^{1} \]
      7. add-sqr-sqrt78.6%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right)}^{1} \]
    12. Applied egg-rr78.6%

      \[\leadsto \color{blue}{{\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    13. Step-by-step derivation
      1. unpow178.6%

        \[\leadsto \color{blue}{\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}} \]
      2. *-commutative78.6%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right)} \]
      3. sub-neg78.6%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \color{blue}{\left(1 + \left(-{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right)\right)} \]
      4. distribute-rgt-neg-in78.6%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(-\frac{h}{\ell} \cdot 0.125\right)}\right) \]
      5. *-commutative78.6%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(-\color{blue}{0.125 \cdot \frac{h}{\ell}}\right)\right) \]
      6. distribute-lft-neg-in78.6%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \color{blue}{\left(\left(-0.125\right) \cdot \frac{h}{\ell}\right)}\right) \]
      7. metadata-eval78.6%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\color{blue}{-0.125} \cdot \frac{h}{\ell}\right)\right) \]
      8. associate-*r*78.5%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right) \cdot \frac{h}{\ell}}\right) \]
      9. *-commutative78.5%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \color{blue}{\frac{h}{\ell} \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right)}\right) \]
      10. *-commutative78.5%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \color{blue}{\left(-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)}\right) \]
      11. associate-*r/77.7%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\color{blue}{\left(\frac{D \cdot M}{d}\right)}}^{2}\right)\right) \]
      12. *-commutative77.7%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(\frac{\color{blue}{M \cdot D}}{d}\right)}^{2}\right)\right) \]
      13. associate-/l*78.5%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\color{blue}{\left(M \cdot \frac{D}{d}\right)}}^{2}\right)\right) \]
    14. Simplified78.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -8.8 \cdot 10^{+129}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\ \mathbf{elif}\;h \leq -4.5 \cdot 10^{-303}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 63.0% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\ t_1 := {\left(M\_m \cdot \frac{D}{d}\right)}^{2}\\ \mathbf{if}\;d \leq -1.72 \cdot 10^{+155}:\\ \;\;\;\;\left|t\_0\right|\\ \mathbf{elif}\;d \leq -5.3 \cdot 10^{-285}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.125 \cdot \left(h \cdot \frac{t\_1}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(t\_1 \cdot -0.125\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0 (/ d (sqrt (* l h)))) (t_1 (pow (* M_m (/ D d)) 2.0)))
   (if (<= d -1.72e+155)
     (fabs t_0)
     (if (<= d -5.3e-285)
       (* (sqrt (* (/ d h) (/ d l))) (- 1.0 (* 0.125 (* h (/ t_1 l)))))
       (* t_0 (+ 1.0 (* (/ h l) (* t_1 -0.125))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double t_0 = d / sqrt((l * h));
	double t_1 = pow((M_m * (D / d)), 2.0);
	double tmp;
	if (d <= -1.72e+155) {
		tmp = fabs(t_0);
	} else if (d <= -5.3e-285) {
		tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.125 * (h * (t_1 / l))));
	} else {
		tmp = t_0 * (1.0 + ((h / l) * (t_1 * -0.125)));
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = d / sqrt((l * h))
    t_1 = (m_m * (d_1 / d)) ** 2.0d0
    if (d <= (-1.72d+155)) then
        tmp = abs(t_0)
    else if (d <= (-5.3d-285)) then
        tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.125d0 * (h * (t_1 / l))))
    else
        tmp = t_0 * (1.0d0 + ((h / l) * (t_1 * (-0.125d0))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double t_0 = d / Math.sqrt((l * h));
	double t_1 = Math.pow((M_m * (D / d)), 2.0);
	double tmp;
	if (d <= -1.72e+155) {
		tmp = Math.abs(t_0);
	} else if (d <= -5.3e-285) {
		tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.125 * (h * (t_1 / l))));
	} else {
		tmp = t_0 * (1.0 + ((h / l) * (t_1 * -0.125)));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	t_0 = d / math.sqrt((l * h))
	t_1 = math.pow((M_m * (D / d)), 2.0)
	tmp = 0
	if d <= -1.72e+155:
		tmp = math.fabs(t_0)
	elif d <= -5.3e-285:
		tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.125 * (h * (t_1 / l))))
	else:
		tmp = t_0 * (1.0 + ((h / l) * (t_1 * -0.125)))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	t_0 = Float64(d / sqrt(Float64(l * h)))
	t_1 = Float64(M_m * Float64(D / d)) ^ 2.0
	tmp = 0.0
	if (d <= -1.72e+155)
		tmp = abs(t_0);
	elseif (d <= -5.3e-285)
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.125 * Float64(h * Float64(t_1 / l)))));
	else
		tmp = Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(t_1 * -0.125))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	t_0 = d / sqrt((l * h));
	t_1 = (M_m * (D / d)) ^ 2.0;
	tmp = 0.0;
	if (d <= -1.72e+155)
		tmp = abs(t_0);
	elseif (d <= -5.3e-285)
		tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.125 * (h * (t_1 / l))));
	else
		tmp = t_0 * (1.0 + ((h / l) * (t_1 * -0.125)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -1.72e+155], N[Abs[t$95$0], $MachinePrecision], If[LessEqual[d, -5.3e-285], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.125 * N[(h * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(t$95$1 * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_1 := {\left(M\_m \cdot \frac{D}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -1.72 \cdot 10^{+155}:\\
\;\;\;\;\left|t\_0\right|\\

\mathbf{elif}\;d \leq -5.3 \cdot 10^{-285}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.125 \cdot \left(h \cdot \frac{t\_1}{\ell}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(t\_1 \cdot -0.125\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.7199999999999999e155

    1. Initial program 52.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. Simplified56.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 0.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity0.9%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow0.9%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow10.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval0.9%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr0.9%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity0.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified0.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 0.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative0.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*0.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified0.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt0.3%

        \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
      2. sqrt-unprod32.9%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      3. swap-sqr16.6%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      4. sqr-neg16.6%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt16.6%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/16.6%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      7. div-inv16.6%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg16.6%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
      9. frac-times40.6%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod48.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      11. frac-2neg48.2%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv67.2%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. add-sqr-sqrt67.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}}} \]
      14. sqrt-prod40.3%

        \[\leadsto \color{blue}{\sqrt{\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)}} \]
      15. rem-sqrt-square67.2%

        \[\leadsto \color{blue}{\left|\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right|} \]
    13. Applied egg-rr77.1%

      \[\leadsto \color{blue}{\left|\frac{d}{\sqrt{h \cdot \ell}}\right|} \]

    if -1.7199999999999999e155 < d < -5.3e-285

    1. Initial program 62.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. Simplified63.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. pow163.3%

        \[\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-unprod49.1%

        \[\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-rr49.1%

      \[\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. unpow149.1%

        \[\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. Simplified49.1%

      \[\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) \]
    8. Taylor expanded in M around 0 39.3%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
    9. Step-by-step derivation
      1. *-commutative39.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.125}\right) \]
      2. associate-*r*41.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      3. times-frac38.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)} \cdot 0.125\right) \]
      4. *-commutative38.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      5. associate-/l*38.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{\left({M}^{2} \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      6. unpow238.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\color{blue}{\left(M \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      7. unpow238.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      8. unpow238.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      9. times-frac43.0%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr49.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow249.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{{\left(M \cdot \frac{D}{d}\right)}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      12. associate-*r/49.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      13. *-commutative49.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      14. associate-/l*49.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(D \cdot \frac{M}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
    10. Simplified49.1%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125}\right) \]
    11. Taylor expanded in D around 0 39.3%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}} \cdot 0.125\right) \]
    12. Step-by-step derivation
      1. associate-*r*41.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      2. times-frac38.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)} \cdot 0.125\right) \]
      3. associate-/l*37.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{\left({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      4. unpow237.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\color{blue}{\left(D \cdot D\right)} \cdot \frac{{M}^{2}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      5. unpow237.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(D \cdot D\right) \cdot \frac{\color{blue}{M \cdot M}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      6. unpow237.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{\color{blue}{d \cdot d}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      7. times-frac40.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(D \cdot D\right) \cdot \color{blue}{\left(\frac{M}{d} \cdot \frac{M}{d}\right)}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      8. swap-sqr49.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{\left(\left(D \cdot \frac{M}{d}\right) \cdot \left(D \cdot \frac{M}{d}\right)\right)} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      9. unpow249.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      10. associate-*r/56.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot h}{\ell}} \cdot 0.125\right) \]
      11. *-commutative56.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{\color{blue}{h \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}}{\ell} \cdot 0.125\right) \]
      12. associate-/l*56.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left(h \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)} \cdot 0.125\right) \]
      13. associate-*r/56.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(h \cdot \frac{{\color{blue}{\left(\frac{D \cdot M}{d}\right)}}^{2}}{\ell}\right) \cdot 0.125\right) \]
      14. *-commutative56.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(h \cdot \frac{{\left(\frac{\color{blue}{M \cdot D}}{d}\right)}^{2}}{\ell}\right) \cdot 0.125\right) \]
      15. associate-/l*56.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(h \cdot \frac{{\color{blue}{\left(M \cdot \frac{D}{d}\right)}}^{2}}{\ell}\right) \cdot 0.125\right) \]
    13. Simplified56.6%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)} \cdot 0.125\right) \]

    if -5.3e-285 < d

    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.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. pow168.0%

        \[\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-unprod57.9%

        \[\leadsto {\color{blue}{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}}^{1} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr57.9%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}^{1}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. unpow157.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Simplified57.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    8. Taylor expanded in M around 0 36.1%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
    9. Step-by-step derivation
      1. *-commutative36.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.125}\right) \]
      2. associate-*r*36.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      3. times-frac37.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)} \cdot 0.125\right) \]
      4. *-commutative37.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      5. associate-/l*37.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{\left({M}^{2} \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      6. unpow237.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\color{blue}{\left(M \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      7. unpow237.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      8. unpow237.5%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\left(\left(M \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      9. times-frac43.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      10. swap-sqr57.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \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) \cdot 0.125\right) \]
      11. unpow257.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(\color{blue}{{\left(M \cdot \frac{D}{d}\right)}^{2}} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      12. associate-*r/57.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      13. *-commutative57.1%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
      14. associate-/l*57.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\color{blue}{\left(D \cdot \frac{M}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \]
    10. Simplified57.9%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125}\right) \]
    11. Step-by-step derivation
      1. pow157.9%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right)\right)}^{1}} \]
      2. *-commutative57.9%

        \[\leadsto {\color{blue}{\left(\left(1 - \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.125\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}}^{1} \]
      3. associate-*l*57.9%

        \[\leadsto {\left(\left(1 - \color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}^{1} \]
      4. frac-times48.9%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right)}^{1} \]
      5. sqrt-div52.9%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}}\right)}^{1} \]
      6. sqrt-unprod75.9%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right)}^{1} \]
      7. add-sqr-sqrt76.2%

        \[\leadsto {\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right)}^{1} \]
    12. Applied egg-rr76.2%

      \[\leadsto \color{blue}{{\left(\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    13. Step-by-step derivation
      1. unpow176.2%

        \[\leadsto \color{blue}{\left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}} \]
      2. *-commutative76.2%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 - {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right)} \]
      3. sub-neg76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \color{blue}{\left(1 + \left(-{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right)\right)} \]
      4. distribute-rgt-neg-in76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(-\frac{h}{\ell} \cdot 0.125\right)}\right) \]
      5. *-commutative76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(-\color{blue}{0.125 \cdot \frac{h}{\ell}}\right)\right) \]
      6. distribute-lft-neg-in76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \color{blue}{\left(\left(-0.125\right) \cdot \frac{h}{\ell}\right)}\right) \]
      7. metadata-eval76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\color{blue}{-0.125} \cdot \frac{h}{\ell}\right)\right) \]
      8. associate-*r*76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right) \cdot \frac{h}{\ell}}\right) \]
      9. *-commutative76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \color{blue}{\frac{h}{\ell} \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right)}\right) \]
      10. *-commutative76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \color{blue}{\left(-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)}\right) \]
      11. associate-*r/75.4%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\color{blue}{\left(\frac{D \cdot M}{d}\right)}}^{2}\right)\right) \]
      12. *-commutative75.4%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(\frac{\color{blue}{M \cdot D}}{d}\right)}^{2}\right)\right) \]
      13. associate-/l*76.2%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\color{blue}{\left(M \cdot \frac{D}{d}\right)}}^{2}\right)\right) \]
    14. Simplified76.2%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification68.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.72 \cdot 10^{+155}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;d \leq -5.3 \cdot 10^{-285}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.125 \cdot \left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 44.4% accurate, 1.5× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.4 \cdot 10^{+113}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;d \leq -6.4 \cdot 10^{-80}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq -3 \cdot 10^{-233}:\\ \;\;\;\;d \cdot \sqrt[3]{{\left(\frac{\frac{1}{\ell}}{h}\right)}^{1.5}}\\ \mathbf{elif}\;d \leq 1.75 \cdot 10^{-153}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= d -1.4e+113)
   (fabs (/ d (sqrt (* l h))))
   (if (<= d -6.4e-80)
     (/ (sqrt (/ d l)) (sqrt (/ h d)))
     (if (<= d -3e-233)
       (* d (cbrt (pow (/ (/ 1.0 l) h) 1.5)))
       (if (<= d 1.75e-153)
         (* d (- (pow (* l h) -0.5)))
         (/ d (* (sqrt h) (sqrt l))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -1.4e+113) {
		tmp = fabs((d / sqrt((l * h))));
	} else if (d <= -6.4e-80) {
		tmp = sqrt((d / l)) / sqrt((h / d));
	} else if (d <= -3e-233) {
		tmp = d * cbrt(pow(((1.0 / l) / h), 1.5));
	} else if (d <= 1.75e-153) {
		tmp = d * -pow((l * h), -0.5);
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -1.4e+113) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else if (d <= -6.4e-80) {
		tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
	} else if (d <= -3e-233) {
		tmp = d * Math.cbrt(Math.pow(((1.0 / l) / h), 1.5));
	} else if (d <= 1.75e-153) {
		tmp = d * -Math.pow((l * h), -0.5);
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (d <= -1.4e+113)
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	elseif (d <= -6.4e-80)
		tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d)));
	elseif (d <= -3e-233)
		tmp = Float64(d * cbrt((Float64(Float64(1.0 / l) / h) ^ 1.5)));
	elseif (d <= 1.75e-153)
		tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -1.4e+113], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -6.4e-80], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3e-233], N[(d * N[Power[N[Power[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.75e-153], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.4 \cdot 10^{+113}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{elif}\;d \leq -6.4 \cdot 10^{-80}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\

\mathbf{elif}\;d \leq -3 \cdot 10^{-233}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{\frac{1}{\ell}}{h}\right)}^{1.5}}\\

\mathbf{elif}\;d \leq 1.75 \cdot 10^{-153}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -1.39999999999999999e113

    1. Initial program 54.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. Simplified57.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 1.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity1.2%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow1.2%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow11.2%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval1.2%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr1.2%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity1.2%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified1.2%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 1.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative1.2%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*1.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified1.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt0.2%

        \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
      2. sqrt-unprod35.3%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      3. swap-sqr22.7%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      4. sqr-neg22.7%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt22.8%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/22.8%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      7. div-inv22.8%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg22.8%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
      9. frac-times41.3%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod47.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      11. frac-2neg47.2%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv64.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. add-sqr-sqrt64.8%

        \[\leadsto \color{blue}{\sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}}} \]
      14. sqrt-prod41.0%

        \[\leadsto \color{blue}{\sqrt{\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)}} \]
      15. rem-sqrt-square64.9%

        \[\leadsto \color{blue}{\left|\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right|} \]
    13. Applied egg-rr72.7%

      \[\leadsto \color{blue}{\left|\frac{d}{\sqrt{h \cdot \ell}}\right|} \]

    if -1.39999999999999999e113 < d < -6.3999999999999998e-80

    1. Initial program 72.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. Simplified72.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.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity6.3%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow6.3%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow16.3%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval6.3%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr6.3%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity6.3%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified6.3%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 6.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative6.3%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*6.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified6.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt0.6%

        \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
      2. sqrt-unprod40.8%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      3. swap-sqr40.6%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      4. sqr-neg40.6%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt40.7%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/40.7%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      7. div-inv40.7%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg40.7%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
      9. frac-times40.6%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod56.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      11. frac-2neg56.7%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv56.7%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. *-commutative56.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}} \]
      14. clear-num56.6%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{1}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      15. un-div-inv56.7%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      16. sqrt-undiv56.8%

        \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\color{blue}{\sqrt{\frac{-h}{-d}}}} \]
      17. frac-2neg56.8%

        \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\color{blue}{\frac{h}{d}}}} \]
    13. Applied egg-rr56.8%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}} \]

    if -6.3999999999999998e-80 < d < -2.99999999999999999e-233

    1. Initial program 54.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. Simplified54.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 d around inf 16.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity16.7%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow16.7%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow116.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval16.7%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr16.7%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity16.7%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified16.7%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 16.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative16.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*16.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified16.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-cbrt-cube29.5%

        \[\leadsto d \cdot \color{blue}{\sqrt[3]{\left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
      2. pow1/329.5%

        \[\leadsto d \cdot \color{blue}{{\left(\left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}^{0.3333333333333333}} \]
      3. add-sqr-sqrt29.5%

        \[\leadsto d \cdot {\left(\color{blue}{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}^{0.3333333333333333} \]
      4. pow129.5%

        \[\leadsto d \cdot {\left(\color{blue}{{\left(\frac{\frac{1}{\ell}}{h}\right)}^{1}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}^{0.3333333333333333} \]
      5. pow1/229.5%

        \[\leadsto d \cdot {\left({\left(\frac{\frac{1}{\ell}}{h}\right)}^{1} \cdot \color{blue}{{\left(\frac{\frac{1}{\ell}}{h}\right)}^{0.5}}\right)}^{0.3333333333333333} \]
      6. pow-prod-up29.5%

        \[\leadsto d \cdot {\color{blue}{\left({\left(\frac{\frac{1}{\ell}}{h}\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333} \]
      7. div-inv29.5%

        \[\leadsto d \cdot {\left({\color{blue}{\left(\frac{1}{\ell} \cdot \frac{1}{h}\right)}}^{\left(1 + 0.5\right)}\right)}^{0.3333333333333333} \]
      8. frac-times29.5%

        \[\leadsto d \cdot {\left({\color{blue}{\left(\frac{1 \cdot 1}{\ell \cdot h}\right)}}^{\left(1 + 0.5\right)}\right)}^{0.3333333333333333} \]
      9. metadata-eval29.5%

        \[\leadsto d \cdot {\left({\left(\frac{\color{blue}{1}}{\ell \cdot h}\right)}^{\left(1 + 0.5\right)}\right)}^{0.3333333333333333} \]
      10. metadata-eval29.5%

        \[\leadsto d \cdot {\left({\left(\frac{1}{\ell \cdot h}\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} \]
    13. Applied egg-rr29.5%

      \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{\ell \cdot h}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
    14. Step-by-step derivation
      1. unpow1/329.5%

        \[\leadsto d \cdot \color{blue}{\sqrt[3]{{\left(\frac{1}{\ell \cdot h}\right)}^{1.5}}} \]
      2. associate-/r*29.5%

        \[\leadsto d \cdot \sqrt[3]{{\color{blue}{\left(\frac{\frac{1}{\ell}}{h}\right)}}^{1.5}} \]
    15. Simplified29.5%

      \[\leadsto d \cdot \color{blue}{\sqrt[3]{{\left(\frac{\frac{1}{\ell}}{h}\right)}^{1.5}}} \]

    if -2.99999999999999999e-233 < d < 1.7499999999999999e-153

    1. Initial program 40.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. Simplified42.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 18.1%

      \[\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. *-commutative0.0%

        \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot d} \]
      3. unpow20.0%

        \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot d \]
      4. rem-square-sqrt29.7%

        \[\leadsto \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot d \]
      5. *-commutative29.7%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot -1\right)} \cdot d \]
      6. associate-*r*29.7%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-1 \cdot d\right)} \]
      7. unpow1/229.7%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot \left(-1 \cdot d\right) \]
      8. rem-exp-log29.3%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot \left(-1 \cdot d\right) \]
      9. exp-neg29.3%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot \left(-1 \cdot d\right) \]
      10. exp-prod29.3%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot \left(-1 \cdot d\right) \]
      11. distribute-lft-neg-out29.3%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot \left(-1 \cdot d\right) \]
      12. distribute-rgt-neg-in29.3%

        \[\leadsto e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot \left(-1 \cdot d\right) \]
      13. metadata-eval29.3%

        \[\leadsto e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot \left(-1 \cdot d\right) \]
      14. exp-to-pow29.7%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \left(-1 \cdot d\right) \]
      15. neg-mul-129.7%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left(-d\right)} \]
    7. Simplified29.7%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]

    if 1.7499999999999999e-153 < d

    1. Initial program 75.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified76.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 64.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity64.9%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow64.9%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow164.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval64.9%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr64.9%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity64.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified64.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 64.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative64.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*65.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified65.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt65.0%

        \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
      2. sqrt-unprod50.2%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      3. swap-sqr43.0%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      4. sqr-neg43.0%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt43.1%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/43.1%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      7. div-inv43.1%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg43.1%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
      9. frac-times47.6%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod54.1%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      11. frac-2neg54.1%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}} \]
      14. sqrt-div0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}} \]
      15. frac-times0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{-d}}{\sqrt{\ell} \cdot \sqrt{-h}}} \]
    13. Applied egg-rr69.6%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification55.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.4 \cdot 10^{+113}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;d \leq -6.4 \cdot 10^{-80}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq -3 \cdot 10^{-233}:\\ \;\;\;\;d \cdot \sqrt[3]{{\left(\frac{\frac{1}{\ell}}{h}\right)}^{1.5}}\\ \mathbf{elif}\;d \leq 1.75 \cdot 10^{-153}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 45.0% accurate, 1.5× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.22 \cdot 10^{+104}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\ell \leq 2.75 \cdot 10^{-229}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -1.22e+104)
   (/ (sqrt (/ d l)) (sqrt (/ h d)))
   (if (<= l 2.75e-229)
     (* (- d) (sqrt (/ 1.0 (* l h))))
     (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -1.22e+104) {
		tmp = sqrt((d / l)) / sqrt((h / d));
	} else if (l <= 2.75e-229) {
		tmp = -d * sqrt((1.0 / (l * h)));
	} else {
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-1.22d+104)) then
        tmp = sqrt((d / l)) / sqrt((h / d))
    else if (l <= 2.75d-229) then
        tmp = -d * sqrt((1.0d0 / (l * h)))
    else
        tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -1.22e+104) {
		tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
	} else if (l <= 2.75e-229) {
		tmp = -d * Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= -1.22e+104:
		tmp = math.sqrt((d / l)) / math.sqrt((h / d))
	elif l <= 2.75e-229:
		tmp = -d * math.sqrt((1.0 / (l * h)))
	else:
		tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= -1.22e+104)
		tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d)));
	elseif (l <= 2.75e-229)
		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= -1.22e+104)
		tmp = sqrt((d / l)) / sqrt((h / d));
	elseif (l <= 2.75e-229)
		tmp = -d * sqrt((1.0 / (l * h)));
	else
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1.22e+104], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.75e-229], N[((-d) * N[Sqrt[N[(1.0 / 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}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.22 \cdot 10^{+104}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\

\mathbf{elif}\;\ell \leq 2.75 \cdot 10^{-229}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.22e104

    1. Initial program 43.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. Simplified46.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 3.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity3.6%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow3.6%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow13.6%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval3.6%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr3.6%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity3.6%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified3.6%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 3.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative3.6%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*3.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified3.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt2.6%

        \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
      2. sqrt-unprod19.7%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      3. swap-sqr12.8%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      4. sqr-neg12.8%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt12.9%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/12.8%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      7. div-inv12.9%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg12.9%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
      9. frac-times26.2%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod36.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      11. frac-2neg36.7%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv40.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. *-commutative40.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}} \]
      14. clear-num40.9%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{1}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      15. un-div-inv40.9%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      16. sqrt-undiv36.7%

        \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\color{blue}{\sqrt{\frac{-h}{-d}}}} \]
      17. frac-2neg36.7%

        \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\color{blue}{\frac{h}{d}}}} \]
    13. Applied egg-rr36.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}} \]

    if -1.22e104 < l < 2.7500000000000001e-229

    1. Initial program 66.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in l around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      3. unpow20.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      4. rem-square-sqrt44.4%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      5. neg-mul-144.4%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    6. Simplified44.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if 2.7500000000000001e-229 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified71.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 62.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. associate-/r*63.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      2. sqrt-div66.5%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
    6. Applied egg-rr66.5%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.22 \cdot 10^{+104}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\ell \leq 2.75 \cdot 10^{-229}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 45.0% accurate, 1.5× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.1 \cdot 10^{+107}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 1.42 \cdot 10^{-229}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -2.1e+107)
   (* (sqrt (/ d h)) (sqrt (/ d l)))
   (if (<= l 1.42e-229)
     (* (- d) (sqrt (/ 1.0 (* l h))))
     (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -2.1e+107) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (l <= 1.42e-229) {
		tmp = -d * sqrt((1.0 / (l * h)));
	} else {
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-2.1d+107)) then
        tmp = sqrt((d / h)) * sqrt((d / l))
    else if (l <= 1.42d-229) then
        tmp = -d * sqrt((1.0d0 / (l * h)))
    else
        tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -2.1e+107) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (l <= 1.42e-229) {
		tmp = -d * Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= -2.1e+107:
		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
	elif l <= 1.42e-229:
		tmp = -d * math.sqrt((1.0 / (l * h)))
	else:
		tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= -2.1e+107)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (l <= 1.42e-229)
		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= -2.1e+107)
		tmp = sqrt((d / h)) * sqrt((d / l));
	elseif (l <= 1.42e-229)
		tmp = -d * sqrt((1.0 / (l * h)));
	else
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -2.1e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.42e-229], N[((-d) * N[Sqrt[N[(1.0 / 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}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;\ell \leq 1.42 \cdot 10^{-229}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -2.1e107

    1. Initial program 43.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. Simplified46.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 36.7%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]

    if -2.1e107 < l < 1.42000000000000004e-229

    1. Initial program 66.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in l around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      3. unpow20.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      4. rem-square-sqrt44.4%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      5. neg-mul-144.4%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    6. Simplified44.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if 1.42000000000000004e-229 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified71.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 62.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. associate-/r*63.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      2. sqrt-div66.5%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
    6. Applied egg-rr66.5%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.1 \cdot 10^{+107}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 1.42 \cdot 10^{-229}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 43.7% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 4 \cdot 10^{-86}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= M_m 4e-86)
   (fabs (/ d (sqrt (* l h))))
   (* d (pow (+ -1.0 (fma h l 1.0)) -0.5))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (M_m <= 4e-86) {
		tmp = fabs((d / sqrt((l * h))));
	} else {
		tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (M_m <= 4e-86)
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	else
		tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[M$95$m, 4e-86], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 4 \cdot 10^{-86}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 4.00000000000000034e-86

    1. Initial program 61.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified62.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 35.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity35.9%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow35.9%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow135.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval35.9%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr35.9%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity35.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified35.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 35.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative35.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*35.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified35.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt32.1%

        \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
      2. sqrt-unprod37.6%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      3. swap-sqr33.7%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      4. sqr-neg33.7%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt33.8%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/33.8%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      7. div-inv33.8%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg33.8%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
      9. frac-times35.7%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod42.1%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      11. frac-2neg42.1%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv20.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. add-sqr-sqrt19.9%

        \[\leadsto \color{blue}{\sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}}} \]
      14. sqrt-prod14.1%

        \[\leadsto \color{blue}{\sqrt{\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)}} \]
      15. rem-sqrt-square20.0%

        \[\leadsto \color{blue}{\left|\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right|} \]
    13. Applied egg-rr51.2%

      \[\leadsto \color{blue}{\left|\frac{d}{\sqrt{h \cdot \ell}}\right|} \]

    if 4.00000000000000034e-86 < M

    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. Simplified69.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 22.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity22.5%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow22.5%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow122.5%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval22.5%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr22.5%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity22.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified22.5%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u22.0%

        \[\leadsto d \cdot {\color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(h \cdot \ell\right)\right)\right)}}^{-0.5} \]
      2. expm1-undefine23.4%

        \[\leadsto d \cdot {\color{blue}{\left(e^{\mathsf{log1p}\left(h \cdot \ell\right)} - 1\right)}}^{-0.5} \]
    10. Applied egg-rr23.4%

      \[\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-neg23.4%

        \[\leadsto d \cdot {\color{blue}{\left(e^{\mathsf{log1p}\left(h \cdot \ell\right)} + \left(-1\right)\right)}}^{-0.5} \]
      2. metadata-eval23.4%

        \[\leadsto d \cdot {\left(e^{\mathsf{log1p}\left(h \cdot \ell\right)} + \color{blue}{-1}\right)}^{-0.5} \]
      3. +-commutative23.4%

        \[\leadsto d \cdot {\color{blue}{\left(-1 + e^{\mathsf{log1p}\left(h \cdot \ell\right)}\right)}}^{-0.5} \]
      4. log1p-undefine23.4%

        \[\leadsto d \cdot {\left(-1 + e^{\color{blue}{\log \left(1 + h \cdot \ell\right)}}\right)}^{-0.5} \]
      5. rem-exp-log23.8%

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\left(1 + h \cdot \ell\right)}\right)}^{-0.5} \]
      6. +-commutative23.8%

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\left(h \cdot \ell + 1\right)}\right)}^{-0.5} \]
      7. fma-define23.8%

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\mathsf{fma}\left(h, \ell, 1\right)}\right)}^{-0.5} \]
    12. Simplified23.8%

      \[\leadsto d \cdot {\color{blue}{\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}}^{-0.5} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 4 \cdot 10^{-86}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 45.4% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 2.45 \cdot 10^{-228}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l 2.45e-228)
   (* (- d) (sqrt (/ 1.0 (* l h))))
   (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 2.45e-228) {
		tmp = -d * sqrt((1.0 / (l * h)));
	} else {
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= 2.45d-228) then
        tmp = -d * sqrt((1.0d0 / (l * h)))
    else
        tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 2.45e-228) {
		tmp = -d * Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= 2.45e-228:
		tmp = -d * math.sqrt((1.0 / (l * h)))
	else:
		tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= 2.45e-228)
		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= 2.45e-228)
		tmp = -d * sqrt((1.0 / (l * h)));
	else
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 2.45e-228], N[((-d) * N[Sqrt[N[(1.0 / 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}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.45 \cdot 10^{-228}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\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.44999999999999994e-228

    1. Initial program 59.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. 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 l around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      3. unpow20.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      4. rem-square-sqrt39.2%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      5. neg-mul-139.2%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    6. Simplified39.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if 2.44999999999999994e-228 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified71.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 62.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. associate-/r*63.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      2. sqrt-div66.5%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
    6. Applied egg-rr66.5%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 2.45 \cdot 10^{-228}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 45.4% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.52 \cdot 10^{-229}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l 1.52e-229)
   (* (- d) (sqrt (/ 1.0 (* l h))))
   (/ d (* (sqrt h) (sqrt l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 1.52e-229) {
		tmp = -d * sqrt((1.0 / (l * h)));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= 1.52d-229) then
        tmp = -d * sqrt((1.0d0 / (l * h)))
    else
        tmp = d / (sqrt(h) * sqrt(l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 1.52e-229) {
		tmp = -d * Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= 1.52e-229:
		tmp = -d * math.sqrt((1.0 / (l * h)))
	else:
		tmp = d / (math.sqrt(h) * math.sqrt(l))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= 1.52e-229)
		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h))));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= 1.52e-229)
		tmp = -d * sqrt((1.0 / (l * h)));
	else
		tmp = d / (sqrt(h) * sqrt(l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 1.52e-229], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.52 \cdot 10^{-229}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 1.5199999999999999e-229

    1. Initial program 59.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. 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 l around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      3. unpow20.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      4. rem-square-sqrt39.2%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      5. neg-mul-139.2%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    6. Simplified39.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if 1.5199999999999999e-229 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified71.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 62.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity62.9%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow62.9%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow162.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval62.9%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr62.9%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity62.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified62.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 62.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative62.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*63.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified63.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt63.0%

        \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
      2. sqrt-unprod47.2%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      3. swap-sqr40.4%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      4. sqr-neg40.4%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt40.5%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/40.4%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      7. div-inv40.5%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg40.5%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
      9. frac-times45.1%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod51.3%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      11. frac-2neg51.3%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}} \]
      14. sqrt-div0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}} \]
      15. frac-times0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{-d}}{\sqrt{\ell} \cdot \sqrt{-h}}} \]
    13. Applied egg-rr66.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.52 \cdot 10^{-229}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 42.4% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 5 \cdot 10^{-43}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= M_m 5e-43) (fabs (/ d (sqrt (* l h)))) (* d (- (pow (* l h) -0.5)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (M_m <= 5e-43) {
		tmp = fabs((d / sqrt((l * h))));
	} else {
		tmp = d * -pow((l * h), -0.5);
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m_m <= 5d-43) then
        tmp = abs((d / sqrt((l * h))))
    else
        tmp = d * -((l * h) ** (-0.5d0))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (M_m <= 5e-43) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else {
		tmp = d * -Math.pow((l * h), -0.5);
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if M_m <= 5e-43:
		tmp = math.fabs((d / math.sqrt((l * h))))
	else:
		tmp = d * -math.pow((l * h), -0.5)
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (M_m <= 5e-43)
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	else
		tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (M_m <= 5e-43)
		tmp = abs((d / sqrt((l * h))));
	else
		tmp = d * -((l * h) ^ -0.5);
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[M$95$m, 5e-43], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 5 \cdot 10^{-43}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 5.00000000000000019e-43

    1. Initial program 61.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified62.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 34.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity34.6%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow34.6%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow134.6%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval34.6%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr34.6%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity34.6%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified34.6%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 34.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative34.6%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*34.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified34.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt30.9%

        \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
      2. sqrt-unprod36.7%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      3. swap-sqr33.1%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
      4. sqr-neg33.1%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
      5. add-sqr-sqrt33.1%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      6. associate-/l/33.1%

        \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      7. div-inv33.2%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
      8. sqr-neg33.2%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
      9. frac-times35.0%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      10. sqrt-prod41.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      11. frac-2neg41.4%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      12. sqrt-undiv20.6%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      13. add-sqr-sqrt20.6%

        \[\leadsto \color{blue}{\sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}}} \]
      14. sqrt-prod14.7%

        \[\leadsto \color{blue}{\sqrt{\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)}} \]
      15. rem-sqrt-square20.6%

        \[\leadsto \color{blue}{\left|\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right|} \]
    13. Applied egg-rr50.4%

      \[\leadsto \color{blue}{\left|\frac{d}{\sqrt{h \cdot \ell}}\right|} \]

    if 5.00000000000000019e-43 < M

    1. Initial program 69.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified71.0%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 23.8%

      \[\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. *-commutative0.0%

        \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot d} \]
      3. unpow20.0%

        \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot d \]
      4. rem-square-sqrt27.9%

        \[\leadsto \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot d \]
      5. *-commutative27.9%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot -1\right)} \cdot d \]
      6. associate-*r*27.9%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-1 \cdot d\right)} \]
      7. unpow1/227.9%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot \left(-1 \cdot d\right) \]
      8. rem-exp-log26.9%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot \left(-1 \cdot d\right) \]
      9. exp-neg26.9%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot \left(-1 \cdot d\right) \]
      10. exp-prod26.9%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot \left(-1 \cdot d\right) \]
      11. distribute-lft-neg-out26.9%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot \left(-1 \cdot d\right) \]
      12. distribute-rgt-neg-in26.9%

        \[\leadsto e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot \left(-1 \cdot d\right) \]
      13. metadata-eval26.9%

        \[\leadsto e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot \left(-1 \cdot d\right) \]
      14. exp-to-pow27.9%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \left(-1 \cdot d\right) \]
      15. neg-mul-127.9%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left(-d\right)} \]
    7. Simplified27.9%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 5 \cdot 10^{-43}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 42.1% accurate, 2.9× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 6 \cdot 10^{-220}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l 6e-220)
   (* (- d) (sqrt (/ 1.0 (* l h))))
   (* d (sqrt (/ (/ 1.0 l) h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 6e-220) {
		tmp = -d * sqrt((1.0 / (l * h)));
	} else {
		tmp = d * sqrt(((1.0 / l) / h));
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= 6d-220) then
        tmp = -d * sqrt((1.0d0 / (l * h)))
    else
        tmp = d * sqrt(((1.0d0 / l) / h))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 6e-220) {
		tmp = -d * Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = d * Math.sqrt(((1.0 / l) / h));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= 6e-220:
		tmp = -d * math.sqrt((1.0 / (l * h)))
	else:
		tmp = d * math.sqrt(((1.0 / l) / h))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= 6e-220)
		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h))));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= 6e-220)
		tmp = -d * sqrt((1.0 / (l * h)));
	else
		tmp = d * sqrt(((1.0 / l) / h));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 6e-220], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6 \cdot 10^{-220}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 6.00000000000000035e-220

    1. Initial program 59.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. 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 l around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      3. unpow20.0%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      4. rem-square-sqrt39.2%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      5. neg-mul-139.2%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    6. Simplified39.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if 6.00000000000000035e-220 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified71.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 62.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity62.9%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow62.9%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow162.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval62.9%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr62.9%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity62.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified62.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 62.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative62.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*63.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified63.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification49.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 6 \cdot 10^{-220}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 24: 42.2% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.95 \cdot 10^{-229}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l 1.95e-229)
   (* d (- (pow (* l h) -0.5)))
   (* d (sqrt (/ (/ 1.0 l) h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 1.95e-229) {
		tmp = d * -pow((l * h), -0.5);
	} else {
		tmp = d * sqrt(((1.0 / l) / h));
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= 1.95d-229) then
        tmp = d * -((l * h) ** (-0.5d0))
    else
        tmp = d * sqrt(((1.0d0 / l) / h))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 1.95e-229) {
		tmp = d * -Math.pow((l * h), -0.5);
	} else {
		tmp = d * Math.sqrt(((1.0 / l) / h));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= 1.95e-229:
		tmp = d * -math.pow((l * h), -0.5)
	else:
		tmp = d * math.sqrt(((1.0 / l) / h))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= 1.95e-229)
		tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= 1.95e-229)
		tmp = d * -((l * h) ^ -0.5);
	else
		tmp = d * sqrt(((1.0 / l) / h));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 1.95e-229], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.95 \cdot 10^{-229}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 1.94999999999999992e-229

    1. Initial program 59.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. 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 d around inf 10.1%

      \[\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. *-commutative0.0%

        \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot d} \]
      3. unpow20.0%

        \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot d \]
      4. rem-square-sqrt39.2%

        \[\leadsto \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot d \]
      5. *-commutative39.2%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot -1\right)} \cdot d \]
      6. associate-*r*39.2%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-1 \cdot d\right)} \]
      7. unpow1/239.2%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot \left(-1 \cdot d\right) \]
      8. rem-exp-log37.3%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot \left(-1 \cdot d\right) \]
      9. exp-neg37.3%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot \left(-1 \cdot d\right) \]
      10. exp-prod37.3%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot \left(-1 \cdot d\right) \]
      11. distribute-lft-neg-out37.3%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot \left(-1 \cdot d\right) \]
      12. distribute-rgt-neg-in37.3%

        \[\leadsto e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot \left(-1 \cdot d\right) \]
      13. metadata-eval37.3%

        \[\leadsto e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot \left(-1 \cdot d\right) \]
      14. exp-to-pow39.2%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \left(-1 \cdot d\right) \]
      15. neg-mul-139.2%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left(-d\right)} \]
    7. Simplified39.2%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]

    if 1.94999999999999992e-229 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified71.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 62.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity62.9%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. inv-pow62.9%

        \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      3. sqrt-pow162.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      4. metadata-eval62.9%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr62.9%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity62.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified62.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 62.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative62.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*63.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    11. Simplified63.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification49.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.95 \cdot 10^{-229}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 25: 26.9% accurate, 3.1× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	return d * sqrt(((1.0 / l) / h));
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    code = d * sqrt(((1.0d0 / l) / h))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	return d * Math.sqrt(((1.0 / l) / h));
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	return d * math.sqrt(((1.0 / l) / h))
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	return Float64(d * sqrt(Float64(Float64(1.0 / l) / h)))
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
	tmp = d * sqrt(((1.0 / l) / h));
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Derivation
  1. Initial program 64.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. Simplified65.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 31.6%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  5. Step-by-step derivation
    1. *-un-lft-identity31.6%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    2. inv-pow31.6%

      \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
    3. sqrt-pow131.6%

      \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
    4. metadata-eval31.6%

      \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
  6. Applied egg-rr31.6%

    \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
  7. Step-by-step derivation
    1. *-lft-identity31.6%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  8. Simplified31.6%

    \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  9. Taylor expanded in d around 0 31.6%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  10. Step-by-step derivation
    1. *-commutative31.6%

      \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    2. associate-/r*31.7%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
  11. Simplified31.7%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  12. Add Preprocessing

Alternative 26: 26.7% accurate, 3.2× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D) :precision binary64 (/ d (sqrt (* l h))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	return d / sqrt((l * h));
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    code = d / sqrt((l * h))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	return d / Math.sqrt((l * h));
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	return d / math.sqrt((l * h))
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	return Float64(d / sqrt(Float64(l * h)))
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
	tmp = d / sqrt((l * h));
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 64.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. Simplified65.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 31.6%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  5. Step-by-step derivation
    1. *-un-lft-identity31.6%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    2. inv-pow31.6%

      \[\leadsto d \cdot \left(1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
    3. sqrt-pow131.6%

      \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
    4. metadata-eval31.6%

      \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
  6. Applied egg-rr31.6%

    \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
  7. Step-by-step derivation
    1. *-lft-identity31.6%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  8. Simplified31.6%

    \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  9. Taylor expanded in d around 0 31.6%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  10. Step-by-step derivation
    1. *-commutative31.6%

      \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    2. associate-/r*31.7%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
  11. Simplified31.7%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  12. Step-by-step derivation
    1. add-sqr-sqrt28.1%

      \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}}} \]
    2. sqrt-unprod34.1%

      \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
    3. swap-sqr29.5%

      \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)}} \]
    4. sqr-neg29.5%

      \[\leadsto \sqrt{\color{blue}{\left(\left(-d\right) \cdot \left(-d\right)\right)} \cdot \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
    5. add-sqr-sqrt29.5%

      \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    6. associate-/l/29.5%

      \[\leadsto \sqrt{\left(\left(-d\right) \cdot \left(-d\right)\right) \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
    7. div-inv29.6%

      \[\leadsto \sqrt{\color{blue}{\frac{\left(-d\right) \cdot \left(-d\right)}{h \cdot \ell}}} \]
    8. sqr-neg29.6%

      \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \]
    9. frac-times33.9%

      \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    10. frac-times29.6%

      \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
    11. sqrt-div33.4%

      \[\leadsto \color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}} \]
    12. sqrt-unprod27.5%

      \[\leadsto \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}} \]
    13. add-sqr-sqrt31.6%

      \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
  13. Applied egg-rr31.6%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  14. Final simplification31.6%

    \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
  15. Add Preprocessing

Reproduce

?
herbie shell --seed 2024149 
(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)))))