Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.5% → 81.6%
Time: 26.7s
Alternatives: 19
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 67.5% accurate, 1.0× speedup?

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

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

Alternative 1: 81.6% 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 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \sqrt{-d}\\ t_3 := 1 + 0.5 \cdot \left(\left(h \cdot {\left(D \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}\right) \cdot \frac{-1}{\ell}\right)\\ t_4 := \frac{\sqrt{d}}{\sqrt{h}}\\ \mathbf{if}\;\ell \leq -7 \cdot 10^{+97}:\\ \;\;\;\;\frac{t\_2}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot t\_0\right)\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(\frac{t\_2}{\sqrt{-h}} \cdot t\_1\right) \cdot t\_3\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-21}:\\ \;\;\;\;t\_3 \cdot \left(t\_1 \cdot t\_4\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(t\_0 \cdot t\_4\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 l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
        (t_1 (sqrt (/ d l)))
        (t_2 (sqrt (- d)))
        (t_3
         (+
          1.0
          (* 0.5 (* (* h (pow (* D (* M_m (/ 0.5 d))) 2.0)) (/ -1.0 l)))))
        (t_4 (/ (sqrt d) (sqrt h))))
   (if (<= l -7e+97)
     (* (/ t_2 (sqrt (- l))) (* (sqrt (/ d h)) t_0))
     (if (<= l -5e-310)
       (* (* (/ t_2 (sqrt (- h))) t_1) t_3)
       (if (<= l 1.5e-21)
         (* t_3 (* t_1 t_4))
         (* (/ (sqrt d) (sqrt l)) (* t_0 t_4)))))))
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 / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
	double t_1 = sqrt((d / l));
	double t_2 = sqrt(-d);
	double t_3 = 1.0 + (0.5 * ((h * pow((D * (M_m * (0.5 / d))), 2.0)) * (-1.0 / l)));
	double t_4 = sqrt(d) / sqrt(h);
	double tmp;
	if (l <= -7e+97) {
		tmp = (t_2 / sqrt(-l)) * (sqrt((d / h)) * t_0);
	} else if (l <= -5e-310) {
		tmp = ((t_2 / sqrt(-h)) * t_1) * t_3;
	} else if (l <= 1.5e-21) {
		tmp = t_3 * (t_1 * t_4);
	} else {
		tmp = (sqrt(d) / sqrt(l)) * (t_0 * t_4);
	}
	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 = 1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))
    t_1 = sqrt((d / l))
    t_2 = sqrt(-d)
    t_3 = 1.0d0 + (0.5d0 * ((h * ((d_1 * (m_m * (0.5d0 / d))) ** 2.0d0)) * ((-1.0d0) / l)))
    t_4 = sqrt(d) / sqrt(h)
    if (l <= (-7d+97)) then
        tmp = (t_2 / sqrt(-l)) * (sqrt((d / h)) * t_0)
    else if (l <= (-5d-310)) then
        tmp = ((t_2 / sqrt(-h)) * t_1) * t_3
    else if (l <= 1.5d-21) then
        tmp = t_3 * (t_1 * t_4)
    else
        tmp = (sqrt(d) / sqrt(l)) * (t_0 * t_4)
    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 / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
	double t_1 = Math.sqrt((d / l));
	double t_2 = Math.sqrt(-d);
	double t_3 = 1.0 + (0.5 * ((h * Math.pow((D * (M_m * (0.5 / d))), 2.0)) * (-1.0 / l)));
	double t_4 = Math.sqrt(d) / Math.sqrt(h);
	double tmp;
	if (l <= -7e+97) {
		tmp = (t_2 / Math.sqrt(-l)) * (Math.sqrt((d / h)) * t_0);
	} else if (l <= -5e-310) {
		tmp = ((t_2 / Math.sqrt(-h)) * t_1) * t_3;
	} else if (l <= 1.5e-21) {
		tmp = t_3 * (t_1 * t_4);
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(l)) * (t_0 * t_4);
	}
	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 / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))
	t_1 = math.sqrt((d / l))
	t_2 = math.sqrt(-d)
	t_3 = 1.0 + (0.5 * ((h * math.pow((D * (M_m * (0.5 / d))), 2.0)) * (-1.0 / l)))
	t_4 = math.sqrt(d) / math.sqrt(h)
	tmp = 0
	if l <= -7e+97:
		tmp = (t_2 / math.sqrt(-l)) * (math.sqrt((d / h)) * t_0)
	elif l <= -5e-310:
		tmp = ((t_2 / math.sqrt(-h)) * t_1) * t_3
	elif l <= 1.5e-21:
		tmp = t_3 * (t_1 * t_4)
	else:
		tmp = (math.sqrt(d) / math.sqrt(l)) * (t_0 * t_4)
	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(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5)))
	t_1 = sqrt(Float64(d / l))
	t_2 = sqrt(Float64(-d))
	t_3 = Float64(1.0 + Float64(0.5 * Float64(Float64(h * (Float64(D * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) * Float64(-1.0 / l))))
	t_4 = Float64(sqrt(d) / sqrt(h))
	tmp = 0.0
	if (l <= -7e+97)
		tmp = Float64(Float64(t_2 / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * t_0));
	elseif (l <= -5e-310)
		tmp = Float64(Float64(Float64(t_2 / sqrt(Float64(-h))) * t_1) * t_3);
	elseif (l <= 1.5e-21)
		tmp = Float64(t_3 * Float64(t_1 * t_4));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(t_0 * t_4));
	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 / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5));
	t_1 = sqrt((d / l));
	t_2 = sqrt(-d);
	t_3 = 1.0 + (0.5 * ((h * ((D * (M_m * (0.5 / d))) ^ 2.0)) * (-1.0 / l)));
	t_4 = sqrt(d) / sqrt(h);
	tmp = 0.0;
	if (l <= -7e+97)
		tmp = (t_2 / sqrt(-l)) * (sqrt((d / h)) * t_0);
	elseif (l <= -5e-310)
		tmp = ((t_2 / sqrt(-h)) * t_1) * t_3;
	elseif (l <= 1.5e-21)
		tmp = t_3 * (t_1 * t_4);
	else
		tmp = (sqrt(d) / sqrt(l)) * (t_0 * t_4);
	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[(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]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(0.5 * N[(N[(h * N[Power[N[(D * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7e+97], N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[l, 1.5e-21], N[(t$95$3 * N[(t$95$1 * t$95$4), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$4), $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 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{-d}\\
t_3 := 1 + 0.5 \cdot \left(\left(h \cdot {\left(D \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}\right) \cdot \frac{-1}{\ell}\right)\\
t_4 := \frac{\sqrt{d}}{\sqrt{h}}\\
\mathbf{if}\;\ell \leq -7 \cdot 10^{+97}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot t\_0\right)\\

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

\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-21}:\\
\;\;\;\;t\_3 \cdot \left(t\_1 \cdot t\_4\right)\\

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


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

    1. Initial program 46.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. Simplified48.9%

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

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

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

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

    if -7.0000000000000001e97 < l < -4.999999999999985e-310

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l < 1.49999999999999996e-21

    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.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. associate-*r/78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.49999999999999996e-21 < l

    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. Simplified63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 77.9% accurate, 0.3× 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}{h}}\\ t_1 := \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)\\ t_2 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-220}:\\ \;\;\;\;\left(t\_0 \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) \cdot t\_2\\ \mathbf{elif}\;t\_1 \leq 10^{-163} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+208}\right):\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot t\_2\\ \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 h)))
        (t_1
         (*
          (* (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))))))
        (t_2 (sqrt (/ d l))))
   (if (<= t_1 -2e-220)
     (*
      (* t_0 (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
      t_2)
     (if (or (<= t_1 1e-163) (not (<= t_1 2e+208)))
       (fabs (/ d (sqrt (* l h))))
       (* t_0 t_2)))))
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 / h));
	double t_1 = (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))));
	double t_2 = sqrt((d / l));
	double tmp;
	if (t_1 <= -2e-220) {
		tmp = (t_0 * (1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)))) * t_2;
	} else if ((t_1 <= 1e-163) || !(t_1 <= 2e+208)) {
		tmp = fabs((d / sqrt((l * h))));
	} else {
		tmp = t_0 * t_2;
	}
	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 / h))
    t_1 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0))))
    t_2 = sqrt((d / l))
    if (t_1 <= (-2d-220)) then
        tmp = (t_0 * (1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0))))) * t_2
    else if ((t_1 <= 1d-163) .or. (.not. (t_1 <= 2d+208))) then
        tmp = abs((d / sqrt((l * h))))
    else
        tmp = t_0 * t_2
    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 / h));
	double t_1 = (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))));
	double t_2 = Math.sqrt((d / l));
	double tmp;
	if (t_1 <= -2e-220) {
		tmp = (t_0 * (1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)))) * t_2;
	} else if ((t_1 <= 1e-163) || !(t_1 <= 2e+208)) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else {
		tmp = t_0 * t_2;
	}
	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 / h))
	t_1 = (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))))
	t_2 = math.sqrt((d / l))
	tmp = 0
	if t_1 <= -2e-220:
		tmp = (t_0 * (1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)))) * t_2
	elif (t_1 <= 1e-163) or not (t_1 <= 2e+208):
		tmp = math.fabs((d / math.sqrt((l * h))))
	else:
		tmp = t_0 * t_2
	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 / h))
	t_1 = 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)))))
	t_2 = sqrt(Float64(d / l))
	tmp = 0.0
	if (t_1 <= -2e-220)
		tmp = Float64(Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5)))) * t_2);
	elseif ((t_1 <= 1e-163) || !(t_1 <= 2e+208))
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	else
		tmp = Float64(t_0 * t_2);
	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 / h));
	t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))));
	t_2 = sqrt((d / l));
	tmp = 0.0;
	if (t_1 <= -2e-220)
		tmp = (t_0 * (1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5)))) * t_2;
	elseif ((t_1 <= 1e-163) || ~((t_1 <= 2e+208)))
		tmp = abs((d / sqrt((l * h))));
	else
		tmp = t_0 * t_2;
	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 / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -2e-220], N[(N[(t$95$0 * 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] * t$95$2), $MachinePrecision], If[Or[LessEqual[t$95$1, 1e-163], N[Not[LessEqual[t$95$1, 2e+208]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$0 * t$95$2), $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}{h}}\\
t_1 := \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)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-220}:\\
\;\;\;\;\left(t\_0 \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) \cdot t\_2\\

\mathbf{elif}\;t\_1 \leq 10^{-163} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+208}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot t\_2\\


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

    1. Initial program 84.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. Simplified85.6%

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

    if -1.99999999999999998e-220 < (*.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)))) < 9.99999999999999923e-164 or 2e208 < (*.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 21.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. Simplified22.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      3. *-rgt-identity25.7%

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

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

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right| \]
      8. *-rgt-identity30.4%

        \[\leadsto \left|\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right| \]
      9. sqrt-prod24.3%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}\right| \]
      10. frac-times24.3%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right| \]
      11. sqrt-div29.6%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}}\right| \]
      12. sqrt-unprod28.6%

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

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
    10. Applied egg-rr52.8%

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

    if 9.99999999999999923e-164 < (*.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)))) < 2e208

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}} \]
    10. Applied egg-rr99.0%

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

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

Alternative 3: 78.9% accurate, 0.3× 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({\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)\\ t_1 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-220}:\\ \;\;\;\;t\_1 \cdot \left(1 - 0.5 \cdot {\left(\sqrt{\frac{h}{\ell}} \cdot \left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)\right)}^{2}\right)\\ \mathbf{elif}\;t\_0 \leq 10^{-163} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+208}\right):\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0
         (*
          (* (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))))))
        (t_1 (* (sqrt (/ d h)) (sqrt (/ d l)))))
   (if (<= t_0 -2e-220)
     (*
      t_1
      (- 1.0 (* 0.5 (pow (* (sqrt (/ h l)) (* (/ D d) (* M_m 0.5))) 2.0))))
     (if (or (<= t_0 1e-163) (not (<= t_0 2e+208)))
       (fabs (/ d (sqrt (* l h))))
       t_1))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double t_0 = (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))));
	double t_1 = sqrt((d / h)) * sqrt((d / l));
	double tmp;
	if (t_0 <= -2e-220) {
		tmp = t_1 * (1.0 - (0.5 * pow((sqrt((h / l)) * ((D / d) * (M_m * 0.5))), 2.0)));
	} else if ((t_0 <= 1e-163) || !(t_0 <= 2e+208)) {
		tmp = fabs((d / sqrt((l * h))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0))))
    t_1 = sqrt((d / h)) * sqrt((d / l))
    if (t_0 <= (-2d-220)) then
        tmp = t_1 * (1.0d0 - (0.5d0 * ((sqrt((h / l)) * ((d_1 / d) * (m_m * 0.5d0))) ** 2.0d0)))
    else if ((t_0 <= 1d-163) .or. (.not. (t_0 <= 2d+208))) then
        tmp = abs((d / sqrt((l * h))))
    else
        tmp = t_1
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double t_0 = (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))));
	double t_1 = Math.sqrt((d / h)) * Math.sqrt((d / l));
	double tmp;
	if (t_0 <= -2e-220) {
		tmp = t_1 * (1.0 - (0.5 * Math.pow((Math.sqrt((h / l)) * ((D / d) * (M_m * 0.5))), 2.0)));
	} else if ((t_0 <= 1e-163) || !(t_0 <= 2e+208)) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	t_0 = (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))))
	t_1 = math.sqrt((d / h)) * math.sqrt((d / l))
	tmp = 0
	if t_0 <= -2e-220:
		tmp = t_1 * (1.0 - (0.5 * math.pow((math.sqrt((h / l)) * ((D / d) * (M_m * 0.5))), 2.0)))
	elif (t_0 <= 1e-163) or not (t_0 <= 2e+208):
		tmp = math.fabs((d / math.sqrt((l * h))))
	else:
		tmp = t_1
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	t_0 = Float64(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)))))
	t_1 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))
	tmp = 0.0
	if (t_0 <= -2e-220)
		tmp = Float64(t_1 * Float64(1.0 - Float64(0.5 * (Float64(sqrt(Float64(h / l)) * Float64(Float64(D / d) * Float64(M_m * 0.5))) ^ 2.0))));
	elseif ((t_0 <= 1e-163) || !(t_0 <= 2e+208))
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	else
		tmp = t_1;
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))));
	t_1 = sqrt((d / h)) * sqrt((d / l));
	tmp = 0.0;
	if (t_0 <= -2e-220)
		tmp = t_1 * (1.0 - (0.5 * ((sqrt((h / l)) * ((D / d) * (M_m * 0.5))) ^ 2.0)));
	elseif ((t_0 <= 1e-163) || ~((t_0 <= 2e+208)))
		tmp = abs((d / sqrt((l * h))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(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]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-220], N[(t$95$1 * N[(1.0 - N[(0.5 * N[Power[N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$0, 1e-163], N[Not[LessEqual[t$95$0, 2e+208]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\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({\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)\\
t_1 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-220}:\\
\;\;\;\;t\_1 \cdot \left(1 - 0.5 \cdot {\left(\sqrt{\frac{h}{\ell}} \cdot \left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)\right)}^{2}\right)\\

\mathbf{elif}\;t\_0 \leq 10^{-163} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+208}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 84.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. Simplified85.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. add-sqr-sqrt85.7%

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow188.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999998e-220 < (*.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)))) < 9.99999999999999923e-164 or 2e208 < (*.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 21.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. Simplified22.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      3. *-rgt-identity25.7%

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

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

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right| \]
      8. *-rgt-identity30.4%

        \[\leadsto \left|\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right| \]
      9. sqrt-prod24.3%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}\right| \]
      10. frac-times24.3%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right| \]
      11. sqrt-div29.6%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}}\right| \]
      12. sqrt-unprod28.6%

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

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
    10. Applied egg-rr52.8%

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

    if 9.99999999999999923e-164 < (*.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)))) < 2e208

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}} \]
    10. Applied egg-rr99.0%

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

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

Alternative 4: 79.1% accurate, 0.3× 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({\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)\\ t_1 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-220}:\\ \;\;\;\;t\_1 \cdot \left(1 - 0.5 \cdot {\left(\frac{D}{d \cdot \frac{2}{M\_m}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\ \mathbf{elif}\;t\_0 \leq 10^{-163} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+208}\right):\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0
         (*
          (* (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))))))
        (t_1 (* (sqrt (/ d h)) (sqrt (/ d l)))))
   (if (<= t_0 -2e-220)
     (*
      t_1
      (- 1.0 (* 0.5 (pow (* (/ D (* d (/ 2.0 M_m))) (sqrt (/ h l))) 2.0))))
     (if (or (<= t_0 1e-163) (not (<= t_0 2e+208)))
       (fabs (/ d (sqrt (* l h))))
       t_1))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double t_0 = (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))));
	double t_1 = sqrt((d / h)) * sqrt((d / l));
	double tmp;
	if (t_0 <= -2e-220) {
		tmp = t_1 * (1.0 - (0.5 * pow(((D / (d * (2.0 / M_m))) * sqrt((h / l))), 2.0)));
	} else if ((t_0 <= 1e-163) || !(t_0 <= 2e+208)) {
		tmp = fabs((d / sqrt((l * h))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0))))
    t_1 = sqrt((d / h)) * sqrt((d / l))
    if (t_0 <= (-2d-220)) then
        tmp = t_1 * (1.0d0 - (0.5d0 * (((d_1 / (d * (2.0d0 / m_m))) * sqrt((h / l))) ** 2.0d0)))
    else if ((t_0 <= 1d-163) .or. (.not. (t_0 <= 2d+208))) then
        tmp = abs((d / sqrt((l * h))))
    else
        tmp = t_1
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double t_0 = (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))));
	double t_1 = Math.sqrt((d / h)) * Math.sqrt((d / l));
	double tmp;
	if (t_0 <= -2e-220) {
		tmp = t_1 * (1.0 - (0.5 * Math.pow(((D / (d * (2.0 / M_m))) * Math.sqrt((h / l))), 2.0)));
	} else if ((t_0 <= 1e-163) || !(t_0 <= 2e+208)) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	t_0 = (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))))
	t_1 = math.sqrt((d / h)) * math.sqrt((d / l))
	tmp = 0
	if t_0 <= -2e-220:
		tmp = t_1 * (1.0 - (0.5 * math.pow(((D / (d * (2.0 / M_m))) * math.sqrt((h / l))), 2.0)))
	elif (t_0 <= 1e-163) or not (t_0 <= 2e+208):
		tmp = math.fabs((d / math.sqrt((l * h))))
	else:
		tmp = t_1
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	t_0 = Float64(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)))))
	t_1 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))
	tmp = 0.0
	if (t_0 <= -2e-220)
		tmp = Float64(t_1 * Float64(1.0 - Float64(0.5 * (Float64(Float64(D / Float64(d * Float64(2.0 / M_m))) * sqrt(Float64(h / l))) ^ 2.0))));
	elseif ((t_0 <= 1e-163) || !(t_0 <= 2e+208))
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	else
		tmp = t_1;
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))));
	t_1 = sqrt((d / h)) * sqrt((d / l));
	tmp = 0.0;
	if (t_0 <= -2e-220)
		tmp = t_1 * (1.0 - (0.5 * (((D / (d * (2.0 / M_m))) * sqrt((h / l))) ^ 2.0)));
	elseif ((t_0 <= 1e-163) || ~((t_0 <= 2e+208)))
		tmp = abs((d / sqrt((l * h))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(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]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-220], N[(t$95$1 * N[(1.0 - N[(0.5 * N[Power[N[(N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$0, 1e-163], N[Not[LessEqual[t$95$0, 2e+208]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\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({\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)\\
t_1 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-220}:\\
\;\;\;\;t\_1 \cdot \left(1 - 0.5 \cdot {\left(\frac{D}{d \cdot \frac{2}{M\_m}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\

\mathbf{elif}\;t\_0 \leq 10^{-163} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+208}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 84.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. Simplified85.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. add-sqr-sqrt85.7%

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow188.0%

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

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

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

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

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

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

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

    if -1.99999999999999998e-220 < (*.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)))) < 9.99999999999999923e-164 or 2e208 < (*.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 21.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. Simplified22.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      3. *-rgt-identity25.7%

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

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

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right| \]
      8. *-rgt-identity30.4%

        \[\leadsto \left|\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right| \]
      9. sqrt-prod24.3%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}\right| \]
      10. frac-times24.3%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right| \]
      11. sqrt-div29.6%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}}\right| \]
      12. sqrt-unprod28.6%

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

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
    10. Applied egg-rr52.8%

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

    if 9.99999999999999923e-164 < (*.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)))) < 2e208

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}} \]
    10. Applied egg-rr99.0%

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.1000000000000002e194 < l < -4.999999999999985e-310

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

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

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

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

    if -4.999999999999985e-310 < l < 8.0000000000000007e227

    1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.0000000000000007e227 < l

    1. Initial program 47.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. Simplified47.5%

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

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

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

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

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

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

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

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

Alternative 6: 78.3% accurate, 0.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\\ t_1 := \sqrt{\frac{d}{h}} \cdot t\_0\\ t_2 := \sqrt{\frac{d}{\ell}}\\ t_3 := \sqrt{-d}\\ \mathbf{if}\;\ell \leq -1.65 \cdot 10^{+98}:\\ \;\;\;\;\frac{t\_3}{\sqrt{-\ell}} \cdot t\_1\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;t\_2 \cdot \left(t\_0 \cdot \frac{t\_3}{\sqrt{-h}}\right)\\ \mathbf{elif}\;\ell \leq 10^{+227}:\\ \;\;\;\;\left(1 + 0.5 \cdot \left(\left(h \cdot {\left(D \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}\right) \cdot \frac{-1}{\ell}\right)\right) \cdot \left(t\_2 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \frac{\sqrt{d}}{\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 (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
        (t_1 (* (sqrt (/ d h)) t_0))
        (t_2 (sqrt (/ d l)))
        (t_3 (sqrt (- d))))
   (if (<= l -1.65e+98)
     (* (/ t_3 (sqrt (- l))) t_1)
     (if (<= l -5e-310)
       (* t_2 (* t_0 (/ t_3 (sqrt (- h)))))
       (if (<= l 1e+227)
         (*
          (+
           1.0
           (* 0.5 (* (* h (pow (* D (* M_m (/ 0.5 d))) 2.0)) (/ -1.0 l))))
          (* t_2 (/ (sqrt d) (sqrt h))))
         (* t_1 (/ (sqrt d) (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 = 1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
	double t_1 = sqrt((d / h)) * t_0;
	double t_2 = sqrt((d / l));
	double t_3 = sqrt(-d);
	double tmp;
	if (l <= -1.65e+98) {
		tmp = (t_3 / sqrt(-l)) * t_1;
	} else if (l <= -5e-310) {
		tmp = t_2 * (t_0 * (t_3 / sqrt(-h)));
	} else if (l <= 1e+227) {
		tmp = (1.0 + (0.5 * ((h * pow((D * (M_m * (0.5 / d))), 2.0)) * (-1.0 / l)))) * (t_2 * (sqrt(d) / sqrt(h)));
	} else {
		tmp = t_1 * (sqrt(d) / 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) :: t_3
    real(8) :: tmp
    t_0 = 1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))
    t_1 = sqrt((d / h)) * t_0
    t_2 = sqrt((d / l))
    t_3 = sqrt(-d)
    if (l <= (-1.65d+98)) then
        tmp = (t_3 / sqrt(-l)) * t_1
    else if (l <= (-5d-310)) then
        tmp = t_2 * (t_0 * (t_3 / sqrt(-h)))
    else if (l <= 1d+227) then
        tmp = (1.0d0 + (0.5d0 * ((h * ((d_1 * (m_m * (0.5d0 / d))) ** 2.0d0)) * ((-1.0d0) / l)))) * (t_2 * (sqrt(d) / sqrt(h)))
    else
        tmp = t_1 * (sqrt(d) / 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 = 1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
	double t_1 = Math.sqrt((d / h)) * t_0;
	double t_2 = Math.sqrt((d / l));
	double t_3 = Math.sqrt(-d);
	double tmp;
	if (l <= -1.65e+98) {
		tmp = (t_3 / Math.sqrt(-l)) * t_1;
	} else if (l <= -5e-310) {
		tmp = t_2 * (t_0 * (t_3 / Math.sqrt(-h)));
	} else if (l <= 1e+227) {
		tmp = (1.0 + (0.5 * ((h * Math.pow((D * (M_m * (0.5 / d))), 2.0)) * (-1.0 / l)))) * (t_2 * (Math.sqrt(d) / Math.sqrt(h)));
	} else {
		tmp = t_1 * (Math.sqrt(d) / 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 = 1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))
	t_1 = math.sqrt((d / h)) * t_0
	t_2 = math.sqrt((d / l))
	t_3 = math.sqrt(-d)
	tmp = 0
	if l <= -1.65e+98:
		tmp = (t_3 / math.sqrt(-l)) * t_1
	elif l <= -5e-310:
		tmp = t_2 * (t_0 * (t_3 / math.sqrt(-h)))
	elif l <= 1e+227:
		tmp = (1.0 + (0.5 * ((h * math.pow((D * (M_m * (0.5 / d))), 2.0)) * (-1.0 / l)))) * (t_2 * (math.sqrt(d) / math.sqrt(h)))
	else:
		tmp = t_1 * (math.sqrt(d) / 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(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5)))
	t_1 = Float64(sqrt(Float64(d / h)) * t_0)
	t_2 = sqrt(Float64(d / l))
	t_3 = sqrt(Float64(-d))
	tmp = 0.0
	if (l <= -1.65e+98)
		tmp = Float64(Float64(t_3 / sqrt(Float64(-l))) * t_1);
	elseif (l <= -5e-310)
		tmp = Float64(t_2 * Float64(t_0 * Float64(t_3 / sqrt(Float64(-h)))));
	elseif (l <= 1e+227)
		tmp = Float64(Float64(1.0 + Float64(0.5 * Float64(Float64(h * (Float64(D * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) * Float64(-1.0 / l)))) * Float64(t_2 * Float64(sqrt(d) / sqrt(h))));
	else
		tmp = Float64(t_1 * Float64(sqrt(d) / 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 = 1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5));
	t_1 = sqrt((d / h)) * t_0;
	t_2 = sqrt((d / l));
	t_3 = sqrt(-d);
	tmp = 0.0;
	if (l <= -1.65e+98)
		tmp = (t_3 / sqrt(-l)) * t_1;
	elseif (l <= -5e-310)
		tmp = t_2 * (t_0 * (t_3 / sqrt(-h)));
	elseif (l <= 1e+227)
		tmp = (1.0 + (0.5 * ((h * ((D * (M_m * (0.5 / d))) ^ 2.0)) * (-1.0 / l)))) * (t_2 * (sqrt(d) / sqrt(h)));
	else
		tmp = t_1 * (sqrt(d) / 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[(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]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1.65e+98], N[(N[(t$95$3 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, -5e-310], N[(t$95$2 * N[(t$95$0 * N[(t$95$3 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1e+227], N[(N[(1.0 + N[(0.5 * N[(N[(h * N[Power[N[(D * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[Sqrt[d], $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 := 1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\\
t_1 := \sqrt{\frac{d}{h}} \cdot t\_0\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.65 \cdot 10^{+98}:\\
\;\;\;\;\frac{t\_3}{\sqrt{-\ell}} \cdot t\_1\\

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

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

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


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

    1. Initial program 46.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. Simplified48.9%

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

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

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

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

    if -1.65000000000000014e98 < l < -4.999999999999985e-310

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

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

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

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

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

    if -4.999999999999985e-310 < l < 1.0000000000000001e227

    1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0000000000000001e227 < l

    1. Initial program 47.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. Simplified47.5%

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 46.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. Simplified48.9%

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

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

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

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

    if -4.1000000000000001e93 < l < -4.999999999999985e-310

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l < 1.7999999999999999e226

    1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.7999999999999999e226 < l

    1. Initial program 47.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. Simplified47.5%

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

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

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

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

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

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

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

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

Alternative 8: 78.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 := 1 - 0.5 \cdot \left(h \cdot \frac{{\left(0.5 \cdot \frac{D \cdot M\_m}{d}\right)}^{2}}{\ell}\right)\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \sqrt{-d}\\ \mathbf{if}\;d \leq -6 \cdot 10^{-8}:\\ \;\;\;\;\left(\frac{t\_2}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\ \;\;\;\;t\_1 \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{t\_2}{\sqrt{-h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot t\_0\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0 (- 1.0 (* 0.5 (* h (/ (pow (* 0.5 (/ (* D M_m) d)) 2.0) l)))))
        (t_1 (sqrt (/ d l)))
        (t_2 (sqrt (- d))))
   (if (<= d -6e-8)
     (* (* (/ t_2 (sqrt (- l))) (sqrt (/ d h))) t_0)
     (if (<= d -1e-309)
       (*
        t_1
        (*
         (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))
         (/ t_2 (sqrt (- h)))))
       (* (* t_1 (/ (sqrt d) (sqrt h))) 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 = 1.0 - (0.5 * (h * (pow((0.5 * ((D * M_m) / d)), 2.0) / l)));
	double t_1 = sqrt((d / l));
	double t_2 = sqrt(-d);
	double tmp;
	if (d <= -6e-8) {
		tmp = ((t_2 / sqrt(-l)) * sqrt((d / h))) * t_0;
	} else if (d <= -1e-309) {
		tmp = t_1 * ((1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * (t_2 / sqrt(-h)));
	} else {
		tmp = (t_1 * (sqrt(d) / sqrt(h))) * 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 = 1.0d0 - (0.5d0 * (h * (((0.5d0 * ((d_1 * m_m) / d)) ** 2.0d0) / l)))
    t_1 = sqrt((d / l))
    t_2 = sqrt(-d)
    if (d <= (-6d-8)) then
        tmp = ((t_2 / sqrt(-l)) * sqrt((d / h))) * t_0
    else if (d <= (-1d-309)) then
        tmp = t_1 * ((1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * (t_2 / sqrt(-h)))
    else
        tmp = (t_1 * (sqrt(d) / sqrt(h))) * 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 = 1.0 - (0.5 * (h * (Math.pow((0.5 * ((D * M_m) / d)), 2.0) / l)));
	double t_1 = Math.sqrt((d / l));
	double t_2 = Math.sqrt(-d);
	double tmp;
	if (d <= -6e-8) {
		tmp = ((t_2 / Math.sqrt(-l)) * Math.sqrt((d / h))) * t_0;
	} else if (d <= -1e-309) {
		tmp = t_1 * ((1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * (t_2 / Math.sqrt(-h)));
	} else {
		tmp = (t_1 * (Math.sqrt(d) / Math.sqrt(h))) * 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 = 1.0 - (0.5 * (h * (math.pow((0.5 * ((D * M_m) / d)), 2.0) / l)))
	t_1 = math.sqrt((d / l))
	t_2 = math.sqrt(-d)
	tmp = 0
	if d <= -6e-8:
		tmp = ((t_2 / math.sqrt(-l)) * math.sqrt((d / h))) * t_0
	elif d <= -1e-309:
		tmp = t_1 * ((1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * (t_2 / math.sqrt(-h)))
	else:
		tmp = (t_1 * (math.sqrt(d) / math.sqrt(h))) * 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 = Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(0.5 * Float64(Float64(D * M_m) / d)) ^ 2.0) / l))))
	t_1 = sqrt(Float64(d / l))
	t_2 = sqrt(Float64(-d))
	tmp = 0.0
	if (d <= -6e-8)
		tmp = Float64(Float64(Float64(t_2 / sqrt(Float64(-l))) * sqrt(Float64(d / h))) * t_0);
	elseif (d <= -1e-309)
		tmp = Float64(t_1 * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) * Float64(t_2 / sqrt(Float64(-h)))));
	else
		tmp = Float64(Float64(t_1 * Float64(sqrt(d) / sqrt(h))) * 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 = 1.0 - (0.5 * (h * (((0.5 * ((D * M_m) / d)) ^ 2.0) / l)));
	t_1 = sqrt((d / l));
	t_2 = sqrt(-d);
	tmp = 0.0;
	if (d <= -6e-8)
		tmp = ((t_2 / sqrt(-l)) * sqrt((d / h))) * t_0;
	elseif (d <= -1e-309)
		tmp = t_1 * ((1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))) * (t_2 / sqrt(-h)));
	else
		tmp = (t_1 * (sqrt(d) / sqrt(h))) * 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[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(0.5 * N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -6e-8], N[(N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, -1e-309], N[(t$95$1 * N[(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] * N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left(h \cdot \frac{{\left(0.5 \cdot \frac{D \cdot M\_m}{d}\right)}^{2}}{\ell}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;d \leq -6 \cdot 10^{-8}:\\
\;\;\;\;\left(\frac{t\_2}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0\\

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

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.99999999999999946e-8 < d < -1.000000000000002e-309

    1. Initial program 50.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. Simplified47.3%

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

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

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

    if -1.000000000000002e-309 < d

    1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.000000000000002e-309

    1. Initial program 59.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. Simplified58.9%

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

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

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

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

    if -1.000000000000002e-309 < d

    1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 60.3% accurate, 1.4× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 6.1999999999999999e-6

    1. Initial program 63.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      3. *-rgt-identity26.6%

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

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

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

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right| \]
      8. *-rgt-identity45.0%

        \[\leadsto \left|\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right| \]
      9. sqrt-prod38.5%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}\right| \]
      10. frac-times29.2%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right| \]
      11. sqrt-div32.9%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}}\right| \]
      12. sqrt-unprod25.6%

        \[\leadsto \left|\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right| \]
      13. add-sqr-sqrt48.2%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
    10. Applied egg-rr48.2%

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

    if 6.1999999999999999e-6 < D

    1. Initial program 59.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. Simplified60.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. associate-*r/62.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 45.9% 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 -4.9 \cdot 10^{-241}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \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 -4.9e-241)
   (fabs (/ d (sqrt (* l h))))
   (if (<= l -5e-310)
     (/ d (cbrt (pow (* l h) 1.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 (l <= -4.9e-241) {
		tmp = fabs((d / sqrt((l * h))));
	} else if (l <= -5e-310) {
		tmp = d / cbrt(pow((l * h), 1.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 (l <= -4.9e-241) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else if (l <= -5e-310) {
		tmp = d / Math.cbrt(Math.pow((l * h), 1.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 (l <= -4.9e-241)
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	elseif (l <= -5e-310)
		tmp = Float64(d / cbrt((Float64(l * h) ^ 1.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[l, -4.9e-241], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -5e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{-241}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\

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


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

    1. Initial program 57.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. Simplified58.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 M around 0 41.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      3. *-rgt-identity0.0%

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

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right) \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right)}} \]
      6. rem-sqrt-square0.0%

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

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right| \]
      8. *-rgt-identity41.9%

        \[\leadsto \left|\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right| \]
      9. sqrt-prod38.6%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}\right| \]
      10. frac-times28.8%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right| \]
      11. sqrt-div31.4%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}}\right| \]
      12. sqrt-unprod0.0%

        \[\leadsto \left|\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right| \]
      13. add-sqr-sqrt47.0%

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

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

    if -4.8999999999999998e-241 < l < -4.999999999999985e-310

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot \color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}} \]
      4. sqrt-unprod0.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(h \cdot \ell\right)} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      4. pow151.1%

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

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

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(h \cdot \ell\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. *-commutative51.1%

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

        \[\leadsto \frac{d}{{\left({\left(\ell \cdot h\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    14. Applied egg-rr51.1%

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

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}} \]
    16. Simplified51.1%

      \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}} \]

    if -4.999999999999985e-310 < l

    1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.9 \cdot 10^{-241}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 45.8% 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 5.4 \cdot 10^{-292}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l 5.4e-292)
   (* 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 <= 5.4e-292) {
		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 <= 5.4d-292) 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 <= 5.4e-292) {
		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 <= 5.4e-292:
		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 <= 5.4e-292)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h)))));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= 5.4e-292)
		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, 5.4e-292], 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 5.4 \cdot 10^{-292}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\

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


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

    1. Initial program 58.8%

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

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

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt41.5%

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

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

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

    if 5.3999999999999998e-292 < l

    1. Initial program 66.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}} \]
      4. sqrt-div53.4%

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

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      6. add-sqr-sqrt53.4%

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

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

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

Alternative 13: 42.6% 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])\\ \\ \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \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 (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) {
	return fabs((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 = abs((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 Math.abs((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 math.fabs((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 abs(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 = abs((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[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])\\
\\
\left|\frac{d}{\sqrt{\ell \cdot h}}\right|
\end{array}
Derivation
  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. Simplified62.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
    3. *-rgt-identity24.7%

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

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

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

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

      \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right| \]
    8. *-rgt-identity40.3%

      \[\leadsto \left|\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right| \]
    9. sqrt-prod35.3%

      \[\leadsto \left|\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}\right| \]
    10. frac-times26.9%

      \[\leadsto \left|\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right| \]
    11. sqrt-div30.2%

      \[\leadsto \left|\color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}}\right| \]
    12. sqrt-unprod23.1%

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

      \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
  10. Applied egg-rr43.9%

    \[\leadsto \color{blue}{\left|\frac{d}{\sqrt{h \cdot \ell}}\right|} \]
  11. Final simplification43.9%

    \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
  12. Add Preprocessing

Alternative 14: 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 -2.5 \cdot 10^{-241}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\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.5e-241)
   (* d (- (sqrt (/ 1.0 (* l h)))))
   (* d (sqrt (/ (/ 1.0 h) 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.5e-241) {
		tmp = d * -sqrt((1.0 / (l * h)));
	} else {
		tmp = d * sqrt(((1.0 / h) / 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.5d-241)) then
        tmp = d * -sqrt((1.0d0 / (l * h)))
    else
        tmp = d * sqrt(((1.0d0 / h) / 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.5e-241) {
		tmp = d * -Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = d * Math.sqrt(((1.0 / h) / 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.5e-241:
		tmp = d * -math.sqrt((1.0 / (l * h)))
	else:
		tmp = d * math.sqrt(((1.0 / h) / 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.5e-241)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h)))));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / 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.5e-241)
		tmp = d * -sqrt((1.0 / (l * h)));
	else
		tmp = d * sqrt(((1.0 / h) / 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.5e-241], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / 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.5 \cdot 10^{-241}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\

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


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

    1. Initial program 57.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. Simplified58.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 M around 0 41.9%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

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

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt47.0%

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

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

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

    if -2.4999999999999999e-241 < l

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 43.5%

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

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

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

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

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

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -4.0000000000000002e-210 < l

    1. Initial program 65.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}} \]
      5. add-sqr-sqrt41.5%

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

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

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

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

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      2. pow1/241.5%

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

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

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

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

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

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

Alternative 16: 37.0% 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 -5.5 \cdot 10^{-210}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -5.5e-210) (sqrt (* (/ d h) (/ d l))) (* 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 <= -5.5e-210) {
		tmp = sqrt(((d / h) * (d / l)));
	} 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 <= (-5.5d-210)) then
        tmp = sqrt(((d / h) * (d / l)))
    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 <= -5.5e-210) {
		tmp = Math.sqrt(((d / h) * (d / l)));
	} 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 <= -5.5e-210:
		tmp = math.sqrt(((d / h) * (d / l)))
	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 <= -5.5e-210)
		tmp = sqrt(Float64(Float64(d / h) * Float64(d / l)));
	else
		tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= -5.5e-210)
		tmp = sqrt(((d / h) * (d / l)));
	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, -5.5e-210], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{-210}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -5.50000000000000024e-210 < l

    1. Initial program 65.4%

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 41.9%

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

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

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

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -8.00000000000000069e-211 < l

    1. Initial program 65.4%

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 41.9%

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

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

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

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

Alternative 18: 25.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 {\left(\ell \cdot h\right)}^{-0.5} \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 (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) {
	return d * pow((l * h), -0.5);
}
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 * ((l * h) ** (-0.5d0))
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.pow((l * h), -0.5);
}
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.pow((l * h), -0.5)
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 * (Float64(l * h) ^ -0.5))
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 * ((l * h) ^ -0.5);
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[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])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Derivation
  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. Simplified62.9%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}\right)}}^{1} \]
  6. Applied egg-rr35.3%

    \[\leadsto \color{blue}{{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}\right)}^{1}} \]
  7. Step-by-step derivation
    1. unpow135.3%

      \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
    2. unpow1/235.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
  8. Simplified35.3%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity35.3%

      \[\leadsto \color{blue}{1 \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    2. frac-times26.9%

      \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
    3. sqrt-div30.2%

      \[\leadsto 1 \cdot \color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}} \]
    4. sqrt-unprod23.1%

      \[\leadsto 1 \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}} \]
    5. add-sqr-sqrt27.0%

      \[\leadsto 1 \cdot \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
  10. Applied egg-rr27.0%

    \[\leadsto \color{blue}{1 \cdot \frac{d}{\sqrt{h \cdot \ell}}} \]
  11. Step-by-step derivation
    1. *-lft-identity27.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  12. Simplified27.0%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  13. Step-by-step derivation
    1. div-inv27.0%

      \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
    2. pow1/227.0%

      \[\leadsto d \cdot \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \]
    3. pow-flip27.1%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-0.5\right)}} \]
    4. *-commutative27.1%

      \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{\left(-0.5\right)} \]
    5. metadata-eval27.1%

      \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{\color{blue}{-0.5}} \]
  14. Applied egg-rr27.1%

    \[\leadsto \color{blue}{d \cdot {\left(\ell \cdot h\right)}^{-0.5}} \]
  15. Final simplification27.1%

    \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{-0.5} \]
  16. Add Preprocessing

Alternative 19: 25.9% 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 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. Simplified62.9%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in M around 0 40.3%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. pow140.3%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right)}^{1}} \]
    2. pow1/240.3%

      \[\leadsto {\left(\color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right)}^{1} \]
    3. *-rgt-identity40.3%

      \[\leadsto {\left({\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right)}^{1} \]
    4. pow1/240.3%

      \[\leadsto {\left({\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}}\right)}^{1} \]
    5. pow-prod-down35.3%

      \[\leadsto {\color{blue}{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}\right)}}^{1} \]
  6. Applied egg-rr35.3%

    \[\leadsto \color{blue}{{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}\right)}^{1}} \]
  7. Step-by-step derivation
    1. unpow135.3%

      \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
    2. unpow1/235.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
  8. Simplified35.3%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity35.3%

      \[\leadsto \color{blue}{1 \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    2. frac-times26.9%

      \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
    3. sqrt-div30.2%

      \[\leadsto 1 \cdot \color{blue}{\frac{\sqrt{d \cdot d}}{\sqrt{h \cdot \ell}}} \]
    4. sqrt-unprod23.1%

      \[\leadsto 1 \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}} \]
    5. add-sqr-sqrt27.0%

      \[\leadsto 1 \cdot \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
  10. Applied egg-rr27.0%

    \[\leadsto \color{blue}{1 \cdot \frac{d}{\sqrt{h \cdot \ell}}} \]
  11. Step-by-step derivation
    1. *-lft-identity27.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  12. Simplified27.0%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  13. Final simplification27.0%

    \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
  14. Add Preprocessing

Reproduce

?
herbie shell --seed 2024080 
(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)))))