Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.0% → 77.8%
Time: 21.9s
Alternatives: 22
Speedup: 1.0×

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 22 alternatives:

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

Initial Program: 65.0% accurate, 1.0× speedup?

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

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

Alternative 1: 77.8% accurate, 0.5× speedup?

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

\mathbf{elif}\;d \leq 4.2 \cdot 10^{-291}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}, t\_0\right)}{h}\\

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


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

    1. Initial program 64.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. 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/68.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. associate-*l/68.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.35e-194 < d < 4.1999999999999999e-291

    1. Initial program 28.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. Simplified28.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 4.1999999999999999e-291 < d

      1. Initial program 66.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. Simplified68.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. add-cube-cbrt67.7%

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

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

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

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

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

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

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

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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. pow284.6%

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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-prod84.6%

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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-pow187.2%

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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-eval87.2%

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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. associate-*l/87.2%

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.35 \cdot 10^{-194}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;d \leq 4.2 \cdot 10^{-291}:\\ \;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}, \sqrt{\frac{h}{\ell}}\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \cdot \left(1 - 0.5 \cdot {\left(\sqrt{\frac{h}{\ell}} \cdot \left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)\right)}^{2}\right)\\ \end{array} \]
    14. Add Preprocessing

    Alternative 2: 79.5% accurate, 0.6× speedup?

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

      1. Initial program 59.4%

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

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

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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. pow20.0%

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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-prod0.0%

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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-pow10.0%

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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-eval0.0%

          \[\leadsto {\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \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. associate-*l/0.0%

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

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

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

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

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

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

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

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

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

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

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

      if -7.5e116 < l < -3.999999999999988e-310

      1. Initial program 56.2%

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

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

          \[\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. associate-*l/60.0%

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.999999999999988e-310 < l

      1. Initial program 65.6%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified67.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. Step-by-step derivation
        1. pow167.1%

          \[\leadsto \color{blue}{{\left(\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)\right)}^{1}} \]
        2. associate-*r*67.1%

          \[\leadsto {\color{blue}{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \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)}}^{1} \]
        3. sqrt-div79.6%

          \[\leadsto {\left(\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \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)}^{1} \]
        4. sqrt-div83.4%

          \[\leadsto {\left(\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}\right) \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)}^{1} \]
        5. frac-times83.3%

          \[\leadsto {\left(\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{h} \cdot \sqrt{\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)}^{1} \]
        6. add-sqr-sqrt83.4%

          \[\leadsto {\left(\frac{\color{blue}{d}}{\sqrt{h} \cdot \sqrt{\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)}^{1} \]
        7. unpow-prod-down83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 79.4% accurate, 0.8× speedup?

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

      1. Initial program 58.3%

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

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

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

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

      if -1.50000000000000003e-179 < l < -3.999999999999988e-310

      1. Initial program 52.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}{\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/65.3%

          \[\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. associate-*l/65.3%

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.999999999999988e-310 < l

      1. Initial program 65.6%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified67.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. Step-by-step derivation
        1. pow167.1%

          \[\leadsto \color{blue}{{\left(\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)\right)}^{1}} \]
        2. associate-*r*67.1%

          \[\leadsto {\color{blue}{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \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)}}^{1} \]
        3. sqrt-div79.6%

          \[\leadsto {\left(\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \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)}^{1} \]
        4. sqrt-div83.4%

          \[\leadsto {\left(\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}\right) \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)}^{1} \]
        5. frac-times83.3%

          \[\leadsto {\left(\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{h} \cdot \sqrt{\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)}^{1} \]
        6. add-sqr-sqrt83.4%

          \[\leadsto {\left(\frac{\color{blue}{d}}{\sqrt{h} \cdot \sqrt{\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)}^{1} \]
        7. unpow-prod-down83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 78.2% accurate, 0.8× speedup?

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

      1. Initial program 58.3%

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

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

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

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

      if -7.5000000000000004e-187 < l < 8.0000000000000003e-309

      1. Initial program 52.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}{\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. Taylor expanded in M around 0 49.5%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*49.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 8.0000000000000003e-309 < l

      1. Initial program 65.6%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified67.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. Step-by-step derivation
        1. pow167.1%

          \[\leadsto \color{blue}{{\left(\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)\right)}^{1}} \]
        2. associate-*r*67.1%

          \[\leadsto {\color{blue}{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \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)}}^{1} \]
        3. sqrt-div79.6%

          \[\leadsto {\left(\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \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)}^{1} \]
        4. sqrt-div83.4%

          \[\leadsto {\left(\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}\right) \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)}^{1} \]
        5. frac-times83.3%

          \[\leadsto {\left(\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{h} \cdot \sqrt{\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)}^{1} \]
        6. add-sqr-sqrt83.4%

          \[\leadsto {\left(\frac{\color{blue}{d}}{\sqrt{h} \cdot \sqrt{\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)}^{1} \]
        7. unpow-prod-down83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 73.5% accurate, 0.8× speedup?

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

      1. Initial program 71.3%

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

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*56.1%

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

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

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

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

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

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

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

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        9. swap-sqr71.4%

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

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

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

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

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

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

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

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

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

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

      if -1.49999999999999993e-143 < d < -1.34999999999999993e-303

      1. Initial program 19.7%

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

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

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*9.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -1.34999999999999993e-303 < d

      1. Initial program 65.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.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. Step-by-step derivation
        1. pow166.6%

          \[\leadsto \color{blue}{{\left(\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)\right)}^{1}} \]
        2. associate-*r*66.6%

          \[\leadsto {\color{blue}{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \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)}}^{1} \]
        3. sqrt-div79.0%

          \[\leadsto {\left(\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \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)}^{1} \]
        4. sqrt-div82.8%

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

          \[\leadsto {\left(\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{h} \cdot \sqrt{\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)}^{1} \]
        6. add-sqr-sqrt82.8%

          \[\leadsto {\left(\frac{\color{blue}{d}}{\sqrt{h} \cdot \sqrt{\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)}^{1} \]
        7. unpow-prod-down82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 6: 72.2% accurate, 0.8× speedup?

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

      1. Initial program 71.3%

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

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*56.1%

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

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

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

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

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

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

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

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        9. swap-sqr71.4%

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

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

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

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

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

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

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

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

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

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

      if -1.55e-142 < d < -1.34999999999999993e-303

      1. Initial program 19.7%

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

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

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*9.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -1.34999999999999993e-303 < d

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

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

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

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

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

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

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

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

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

    Alternative 7: 72.3% accurate, 1.0× speedup?

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

      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. Simplified56.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. Taylor expanded in M around 0 47.8%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*48.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -9.8000000000000007e-209 < h < 2.2500000000000001e-305

      1. Initial program 51.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. Simplified51.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.2500000000000001e-305 < h

      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. Simplified67.6%

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

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

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

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

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

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

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

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

    Alternative 8: 71.2% accurate, 1.0× speedup?

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

      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. Simplified56.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. Taylor expanded in M around 0 47.8%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*48.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -4.4500000000000003e-209 < h < 2.2500000000000001e-305

      1. Initial program 51.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. Simplified51.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.2500000000000001e-305 < h

      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. Simplified67.6%

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

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

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

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

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

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

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

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

    Alternative 9: 68.4% accurate, 1.0× speedup?

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

      1. Initial program 57.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. Simplified56.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. Taylor expanded in M around 0 43.1%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*43.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.999999999999988e-310 < l < 2.1999999999999999e131

      1. Initial program 72.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. Simplified73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.1999999999999999e131 < l

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

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

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

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

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

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv62.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      7. Step-by-step derivation
        1. associate-/l/62.6%

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

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

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

    Alternative 10: 56.6% accurate, 1.4× speedup?

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

      1. Initial program 60.7%

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

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

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

      if -1.72000000000000008e130 < l < -3.999999999999988e-310

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

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

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*40.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.999999999999988e-310 < l < 8.99999999999999944e132

      1. Initial program 72.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. Simplified73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 8.99999999999999944e132 < l

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

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

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

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

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

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv62.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      7. Step-by-step derivation
        1. associate-/l/62.6%

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

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

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

    Alternative 11: 57.1% accurate, 1.4× speedup?

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

      1. Initial program 60.7%

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

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

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

      if -6.5e127 < l < -3.999999999999988e-310

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

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

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*40.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.999999999999988e-310 < l < 6.5000000000000004e133

      1. Initial program 72.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. Simplified73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 6.5000000000000004e133 < l

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

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

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

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

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

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv62.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      7. Step-by-step derivation
        1. associate-/l/62.6%

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

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

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

    Alternative 12: 50.3% accurate, 1.4× speedup?

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

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

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

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

      if -4.8000000000000002e203 < d < 3.29999999999999997e-289

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

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

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

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

          \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
        2. 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-sqrt35.3%

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

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

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

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

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

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

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

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

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

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

      if 3.29999999999999997e-289 < d < 7.99999999999999987e-45

      1. Initial program 49.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. Simplified49.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 7.99999999999999987e-45 < d

      1. Initial program 80.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. Simplified83.7%

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

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

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

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

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv73.3%

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

          \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      6. Applied egg-rr69.4%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      7. Step-by-step derivation
        1. associate-/l/73.3%

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

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

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

    Alternative 13: 49.7% accurate, 1.4× speedup?

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

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

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

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

      if -8.50000000000000025e203 < d < 3.29999999999999997e-289

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

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

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

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

          \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
        2. 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-sqrt35.3%

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

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

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

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

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

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

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

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

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

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

      if 3.29999999999999997e-289 < d < 3.40000000000000016e-44

      1. Initial program 49.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. Simplified49.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 3.40000000000000016e-44 < d

      1. Initial program 80.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. Simplified83.7%

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

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

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

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

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv73.3%

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

          \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      6. Applied egg-rr69.4%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      7. Step-by-step derivation
        1. associate-/l/73.3%

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

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

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

    Alternative 14: 64.6% accurate, 1.4× speedup?

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

      1. Initial program 57.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. Simplified56.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. Taylor expanded in M around 0 43.1%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*43.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.9999999999999998e-308 < l < 3.8000000000000002e133

      1. Initial program 72.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. Simplified73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 3.8000000000000002e133 < l

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

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

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

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

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

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv62.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      7. Step-by-step derivation
        1. associate-/l/62.6%

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

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

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

    Alternative 15: 64.7% accurate, 1.4× speedup?

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

      1. Initial program 57.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. Simplified56.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. Taylor expanded in M around 0 43.1%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*43.4%

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

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

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

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

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        6. unpow240.1%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        7. times-frac47.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\left(\frac{M}{d} \cdot \frac{M}{d}\right)} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        8. unpow247.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        9. swap-sqr57.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        10. associate-/r/56.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        11. associate-/r/56.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        12. unpow256.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
        13. associate-*l*56.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)}\right) \]
        14. *-commutative56.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)\right)}\right) \]
        15. associate-*l/59.8%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}{\ell}}\right) \]
        16. associate-/l*60.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right) \]
        17. associate-/l*60.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \color{blue}{\left(0.25 \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right)\right) \]
      6. Simplified60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right) \]
      7. Step-by-step derivation
        1. pow160.6%

          \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)\right)\right)}^{1}} \]
        2. sqrt-unprod48.1%

          \[\leadsto {\left(\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)\right)\right)}^{1} \]
        3. associate-*r*48.1%

          \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\left(0.5 \cdot h\right) \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}\right)\right)}^{1} \]
        4. associate-*r/48.1%

          \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(0.5 \cdot h\right) \cdot \color{blue}{\frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right)\right)}^{1} \]
      8. Applied egg-rr48.1%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(0.5 \cdot h\right) \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}^{1}} \]
      9. Step-by-step derivation
        1. unpow148.1%

          \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(0.5 \cdot h\right) \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)} \]
        2. *-commutative48.1%

          \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(0.5 \cdot h\right) \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \]
        3. associate-*l*48.1%

          \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.5 \cdot \left(h \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}\right) \]
        4. associate-/l*48.1%

          \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \color{blue}{\left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}\right)\right) \]
        5. associate-*r/49.7%

          \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d}\right)}}^{2}}{\ell}\right)\right)\right) \]
        6. *-commutative49.7%

          \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2}}{\ell}\right)\right)\right) \]
        7. associate-/l*49.7%

          \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\color{blue}{\left(D \cdot \frac{M}{d}\right)}}^{2}}{\ell}\right)\right)\right) \]
      10. Simplified49.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)\right)\right)} \]

      if 9.0000000000000021e-309 < l < 1.0999999999999999e131

      1. Initial program 72.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. Simplified73.4%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
      3. Add Preprocessing
      4. Step-by-step derivation
        1. add-cube-cbrt73.0%

          \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt[3]{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right) \cdot \sqrt[3]{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        2. pow373.1%

          \[\leadsto \color{blue}{{\left(\sqrt[3]{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)}^{3}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        3. sqrt-div87.7%

          \[\leadsto {\left(\sqrt[3]{\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}}}\right)}^{3} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        4. sqrt-div90.3%

          \[\leadsto {\left(\sqrt[3]{\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}}\right)}^{3} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        5. frac-times90.3%

          \[\leadsto {\left(\sqrt[3]{\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{h} \cdot \sqrt{\ell}}}}\right)}^{3} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        6. add-sqr-sqrt90.4%

          \[\leadsto {\left(\sqrt[3]{\frac{\color{blue}{d}}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. Applied egg-rr90.4%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}\right)}^{3}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. Step-by-step derivation
        1. rem-cube-cbrt90.8%

          \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        2. div-inv90.7%

          \[\leadsto \color{blue}{\left(d \cdot \frac{1}{\sqrt{h} \cdot \sqrt{\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. metadata-eval90.7%

          \[\leadsto \left(d \cdot \frac{\color{blue}{\sqrt{1}}}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        4. sqrt-unprod80.1%

          \[\leadsto \left(d \cdot \frac{\sqrt{1}}{\color{blue}{\sqrt{h \cdot \ell}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        5. sqrt-div80.1%

          \[\leadsto \left(d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        6. *-commutative80.1%

          \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        7. pow1/280.1%

          \[\leadsto \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        8. inv-pow80.1%

          \[\leadsto \left({\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5} \cdot d\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        9. pow-pow80.1%

          \[\leadsto \left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}} \cdot d\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
        10. metadata-eval80.1%

          \[\leadsto \left({\left(h \cdot \ell\right)}^{\color{blue}{-0.5}} \cdot d\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      7. Applied egg-rr80.1%

        \[\leadsto \color{blue}{\left({\left(h \cdot \ell\right)}^{-0.5} \cdot d\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]

      if 1.0999999999999999e131 < l

      1. Initial program 52.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. Simplified54.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in d around inf 41.6%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. Step-by-step derivation
        1. sqrt-div41.5%

          \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
        2. metadata-eval41.5%

          \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
        3. sqrt-unprod62.6%

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv62.6%

          \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        5. associate-/r*56.5%

          \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      6. Applied egg-rr56.5%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      7. Step-by-step derivation
        1. associate-/l/62.6%

          \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      8. Simplified62.6%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification62.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 9 \cdot 10^{-309}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 1.1 \cdot 10^{+131}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 16: 45.8% accurate, 1.5× speedup?

    \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.05 \cdot 10^{+127}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-294}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d h l M_m D_m)
     :precision binary64
     (if (<= l -1.05e+127)
       (* (sqrt (/ d l)) (sqrt (/ d h)))
       (if (<= l 6.5e-294)
         (* (- d) (sqrt (/ (/ 1.0 h) l)))
         (/ d (* (sqrt h) (sqrt l))))))
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d < h && h < l && l < M_m && M_m < D_m);
    double code(double d, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (l <= -1.05e+127) {
    		tmp = sqrt((d / l)) * sqrt((d / h));
    	} else if (l <= 6.5e-294) {
    		tmp = -d * sqrt(((1.0 / h) / l));
    	} else {
    		tmp = d / (sqrt(h) * sqrt(l));
    	}
    	return tmp;
    }
    
    M_m = abs(m)
    D_m = abs(d)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    real(8) function code(d, h, l, m_m, d_m)
        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_m
        real(8) :: tmp
        if (l <= (-1.05d+127)) then
            tmp = sqrt((d / l)) * sqrt((d / h))
        else if (l <= 6.5d-294) then
            tmp = -d * sqrt(((1.0d0 / h) / l))
        else
            tmp = d / (sqrt(h) * sqrt(l))
        end if
        code = tmp
    end function
    
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (l <= -1.05e+127) {
    		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
    	} else if (l <= 6.5e-294) {
    		tmp = -d * Math.sqrt(((1.0 / h) / l));
    	} else {
    		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
    	}
    	return tmp;
    }
    
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
    def code(d, h, l, M_m, D_m):
    	tmp = 0
    	if l <= -1.05e+127:
    		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
    	elif l <= 6.5e-294:
    		tmp = -d * math.sqrt(((1.0 / h) / l))
    	else:
    		tmp = d / (math.sqrt(h) * math.sqrt(l))
    	return tmp
    
    M_m = abs(M)
    D_m = abs(D)
    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
    function code(d, h, l, M_m, D_m)
    	tmp = 0.0
    	if (l <= -1.05e+127)
    		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
    	elseif (l <= 6.5e-294)
    		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l)));
    	else
    		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
    	end
    	return tmp
    end
    
    M_m = abs(M);
    D_m = abs(D);
    d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
    function tmp_2 = code(d, h, l, M_m, D_m)
    	tmp = 0.0;
    	if (l <= -1.05e+127)
    		tmp = sqrt((d / l)) * sqrt((d / h));
    	elseif (l <= 6.5e-294)
    		tmp = -d * sqrt(((1.0 / h) / l));
    	else
    		tmp = d / (sqrt(h) * sqrt(l));
    	end
    	tmp_2 = tmp;
    end
    
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1.05e+127], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e-294], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $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_m = \left|D\right|
    \\
    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;\ell \leq -1.05 \cdot 10^{+127}:\\
    \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
    
    \mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-294}:\\
    \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if l < -1.04999999999999996e127

      1. Initial program 60.7%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified60.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in d around inf 49.9%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]

      if -1.04999999999999996e127 < l < 6.4999999999999995e-294

      1. Initial program 55.0%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified53.9%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in M around 0 39.4%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*39.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell}\right)\right) \]
        2. times-frac37.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)}\right)\right) \]
        3. associate-/l*37.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        4. *-commutative37.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\frac{{M}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        5. unpow237.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        6. unpow237.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        7. times-frac45.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\left(\frac{M}{d} \cdot \frac{M}{d}\right)} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        8. unpow245.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        9. swap-sqr55.1%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        10. associate-/r/53.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        11. associate-/r/53.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        12. unpow253.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
        13. associate-*l*53.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)}\right) \]
        14. *-commutative53.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)\right)}\right) \]
        15. associate-*l/58.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}{\ell}}\right) \]
        16. associate-/l*58.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right) \]
        17. associate-/l*58.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \color{blue}{\left(0.25 \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right)\right) \]
      6. Simplified58.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right) \]
      7. Step-by-step derivation
        1. add-sqr-sqrt58.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)} \cdot \sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}}\right) \]
        2. pow258.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right)}^{2}}\right) \]
        3. associate-*r*58.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left(0.5 \cdot h\right) \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}}\right)}^{2}\right) \]
        4. associate-*r/58.6%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\left(0.5 \cdot h\right) \cdot \color{blue}{\frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}}\right)}^{2}\right) \]
      8. Applied egg-rr58.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{\left(0.5 \cdot h\right) \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right)}^{2}}\right) \]
      9. Taylor expanded in l around -inf 0.0%

        \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      10. Step-by-step derivation
        1. *-commutative0.0%

          \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
        2. associate-/r*0.0%

          \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
        3. *-commutative0.0%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
        4. unpow20.0%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
        5. rem-square-sqrt44.5%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
        6. neg-mul-144.5%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \color{blue}{\left(-d\right)} \]
      11. Simplified44.5%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-d\right)} \]

      if 6.4999999999999995e-294 < l

      1. Initial program 66.4%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified67.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in d around inf 39.9%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. Step-by-step derivation
        1. sqrt-div39.9%

          \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
        2. metadata-eval39.9%

          \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
        3. sqrt-unprod53.6%

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv53.6%

          \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        5. associate-/r*51.5%

          \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      6. Applied egg-rr51.5%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      7. Step-by-step derivation
        1. associate-/l/53.6%

          \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      8. Simplified53.6%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification49.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.05 \cdot 10^{+127}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-294}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 17: 46.8% accurate, 1.6× speedup?

    \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 1.3 \cdot 10^{-270}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d h l M_m D_m)
     :precision binary64
     (if (<= d 1.3e-270)
       (* (- d) (sqrt (/ (/ 1.0 h) l)))
       (/ d (* (sqrt h) (sqrt l)))))
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d < h && h < l && l < M_m && M_m < D_m);
    double code(double d, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (d <= 1.3e-270) {
    		tmp = -d * sqrt(((1.0 / h) / l));
    	} else {
    		tmp = d / (sqrt(h) * sqrt(l));
    	}
    	return tmp;
    }
    
    M_m = abs(m)
    D_m = abs(d)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    real(8) function code(d, h, l, m_m, d_m)
        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_m
        real(8) :: tmp
        if (d <= 1.3d-270) then
            tmp = -d * sqrt(((1.0d0 / h) / l))
        else
            tmp = d / (sqrt(h) * sqrt(l))
        end if
        code = tmp
    end function
    
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (d <= 1.3e-270) {
    		tmp = -d * Math.sqrt(((1.0 / h) / l));
    	} else {
    		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
    	}
    	return tmp;
    }
    
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
    def code(d, h, l, M_m, D_m):
    	tmp = 0
    	if d <= 1.3e-270:
    		tmp = -d * math.sqrt(((1.0 / h) / l))
    	else:
    		tmp = d / (math.sqrt(h) * math.sqrt(l))
    	return tmp
    
    M_m = abs(M)
    D_m = abs(D)
    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
    function code(d, h, l, M_m, D_m)
    	tmp = 0.0
    	if (d <= 1.3e-270)
    		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l)));
    	else
    		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
    	end
    	return tmp
    end
    
    M_m = abs(M);
    D_m = abs(D);
    d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
    function tmp_2 = code(d, h, l, M_m, D_m)
    	tmp = 0.0;
    	if (d <= 1.3e-270)
    		tmp = -d * sqrt(((1.0 / h) / l));
    	else
    		tmp = d / (sqrt(h) * sqrt(l));
    	end
    	tmp_2 = tmp;
    end
    
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 1.3e-270], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $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_m = \left|D\right|
    \\
    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;d \leq 1.3 \cdot 10^{-270}:\\
    \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if d < 1.3000000000000001e-270

      1. Initial program 56.7%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified56.0%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in M around 0 41.2%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*41.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell}\right)\right) \]
        2. times-frac38.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)}\right)\right) \]
        3. associate-/l*38.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        4. *-commutative38.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\frac{{M}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        5. unpow238.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        6. unpow238.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        7. times-frac45.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\left(\frac{M}{d} \cdot \frac{M}{d}\right)} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        8. unpow245.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        9. swap-sqr56.8%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        10. associate-/r/55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        11. associate-/r/55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        12. unpow255.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
        13. associate-*l*55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)}\right) \]
        14. *-commutative55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)\right)}\right) \]
        15. associate-*l/58.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}{\ell}}\right) \]
        16. associate-/l*59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right) \]
        17. associate-/l*59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \color{blue}{\left(0.25 \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right)\right) \]
      6. Simplified60.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right) \]
      7. Step-by-step derivation
        1. add-sqr-sqrt59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)} \cdot \sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}}\right) \]
        2. pow259.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right)}^{2}}\right) \]
        3. associate-*r*59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left(0.5 \cdot h\right) \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}}\right)}^{2}\right) \]
        4. associate-*r/59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\left(0.5 \cdot h\right) \cdot \color{blue}{\frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}}\right)}^{2}\right) \]
      8. Applied egg-rr59.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{\left(0.5 \cdot h\right) \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right)}^{2}}\right) \]
      9. Taylor expanded in l around -inf 0.0%

        \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      10. Step-by-step derivation
        1. *-commutative0.0%

          \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
        2. associate-/r*0.0%

          \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
        3. *-commutative0.0%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
        4. unpow20.0%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
        5. rem-square-sqrt39.1%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
        6. neg-mul-139.1%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \color{blue}{\left(-d\right)} \]
      11. Simplified39.1%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-d\right)} \]

      if 1.3000000000000001e-270 < d

      1. Initial program 66.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. Simplified68.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in d around inf 40.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. Step-by-step derivation
        1. sqrt-div40.7%

          \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
        2. metadata-eval40.7%

          \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
        3. sqrt-unprod54.9%

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv55.0%

          \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        5. associate-/r*52.8%

          \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      6. Applied egg-rr52.8%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      7. Step-by-step derivation
        1. associate-/l/55.0%

          \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      8. Simplified55.0%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification46.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.3 \cdot 10^{-270}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 18: 43.1% accurate, 2.9× speedup?

    \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{if}\;d \leq 1.8 \cdot 10^{-270}:\\ \;\;\;\;\left(-d\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot t\_0\\ \end{array} \end{array} \]
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d h l M_m D_m)
     :precision binary64
     (let* ((t_0 (sqrt (/ (/ 1.0 h) l))))
       (if (<= d 1.8e-270) (* (- d) t_0) (* d t_0))))
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d < h && h < l && l < M_m && M_m < D_m);
    double code(double d, double h, double l, double M_m, double D_m) {
    	double t_0 = sqrt(((1.0 / h) / l));
    	double tmp;
    	if (d <= 1.8e-270) {
    		tmp = -d * t_0;
    	} else {
    		tmp = d * t_0;
    	}
    	return tmp;
    }
    
    M_m = abs(m)
    D_m = abs(d)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    real(8) function code(d, h, l, m_m, d_m)
        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_m
        real(8) :: t_0
        real(8) :: tmp
        t_0 = sqrt(((1.0d0 / h) / l))
        if (d <= 1.8d-270) then
            tmp = -d * t_0
        else
            tmp = d * t_0
        end if
        code = tmp
    end function
    
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d, double h, double l, double M_m, double D_m) {
    	double t_0 = Math.sqrt(((1.0 / h) / l));
    	double tmp;
    	if (d <= 1.8e-270) {
    		tmp = -d * t_0;
    	} else {
    		tmp = d * t_0;
    	}
    	return tmp;
    }
    
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
    def code(d, h, l, M_m, D_m):
    	t_0 = math.sqrt(((1.0 / h) / l))
    	tmp = 0
    	if d <= 1.8e-270:
    		tmp = -d * t_0
    	else:
    		tmp = d * t_0
    	return tmp
    
    M_m = abs(M)
    D_m = abs(D)
    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
    function code(d, h, l, M_m, D_m)
    	t_0 = sqrt(Float64(Float64(1.0 / h) / l))
    	tmp = 0.0
    	if (d <= 1.8e-270)
    		tmp = Float64(Float64(-d) * t_0);
    	else
    		tmp = Float64(d * t_0);
    	end
    	return tmp
    end
    
    M_m = abs(M);
    D_m = abs(D);
    d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
    function tmp_2 = code(d, h, l, M_m, D_m)
    	t_0 = sqrt(((1.0 / h) / l));
    	tmp = 0.0;
    	if (d <= 1.8e-270)
    		tmp = -d * t_0;
    	else
    		tmp = d * t_0;
    	end
    	tmp_2 = tmp;
    end
    
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 1.8e-270], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
    
    \begin{array}{l}
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    t_0 := \sqrt{\frac{\frac{1}{h}}{\ell}}\\
    \mathbf{if}\;d \leq 1.8 \cdot 10^{-270}:\\
    \;\;\;\;\left(-d\right) \cdot t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;d \cdot t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if d < 1.7999999999999999e-270

      1. Initial program 56.7%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified56.0%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in M around 0 41.2%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*41.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell}\right)\right) \]
        2. times-frac38.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)}\right)\right) \]
        3. associate-/l*38.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        4. *-commutative38.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\frac{{M}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        5. unpow238.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        6. unpow238.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        7. times-frac45.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\left(\frac{M}{d} \cdot \frac{M}{d}\right)} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        8. unpow245.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        9. swap-sqr56.8%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        10. associate-/r/55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        11. associate-/r/55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        12. unpow255.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
        13. associate-*l*55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)}\right) \]
        14. *-commutative55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)\right)}\right) \]
        15. associate-*l/58.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}{\ell}}\right) \]
        16. associate-/l*59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right) \]
        17. associate-/l*59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \color{blue}{\left(0.25 \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right)\right) \]
      6. Simplified60.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right) \]
      7. Step-by-step derivation
        1. add-sqr-sqrt59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)} \cdot \sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}}\right) \]
        2. pow259.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right)}^{2}}\right) \]
        3. associate-*r*59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left(0.5 \cdot h\right) \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}}\right)}^{2}\right) \]
        4. associate-*r/59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\left(0.5 \cdot h\right) \cdot \color{blue}{\frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}}\right)}^{2}\right) \]
      8. Applied egg-rr59.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{\left(0.5 \cdot h\right) \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right)}^{2}}\right) \]
      9. Taylor expanded in l around -inf 0.0%

        \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      10. Step-by-step derivation
        1. *-commutative0.0%

          \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
        2. associate-/r*0.0%

          \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
        3. *-commutative0.0%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
        4. unpow20.0%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
        5. rem-square-sqrt39.1%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
        6. neg-mul-139.1%

          \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \color{blue}{\left(-d\right)} \]
      11. Simplified39.1%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-d\right)} \]

      if 1.7999999999999999e-270 < d

      1. Initial program 66.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. Simplified68.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. Taylor expanded in M around 0 37.6%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*39.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell}\right)\right) \]
        2. times-frac39.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)}\right)\right) \]
        3. associate-/l*41.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        4. *-commutative41.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\frac{{M}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        5. unpow241.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        6. unpow241.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        7. times-frac53.8%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\left(\frac{M}{d} \cdot \frac{M}{d}\right)} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        8. unpow253.8%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        9. swap-sqr67.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        10. associate-/r/67.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        11. associate-/r/68.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        12. unpow268.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
        13. associate-*l*68.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)}\right) \]
        14. *-commutative68.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)\right)}\right) \]
        15. associate-*l/66.0%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}{\ell}}\right) \]
        16. associate-/l*68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right) \]
        17. associate-/l*68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \color{blue}{\left(0.25 \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right)\right) \]
      6. Simplified68.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right) \]
      7. Step-by-step derivation
        1. add-sqr-sqrt68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)} \cdot \sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}}\right) \]
        2. pow268.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right)}^{2}}\right) \]
        3. associate-*r*68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left(0.5 \cdot h\right) \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}}\right)}^{2}\right) \]
        4. associate-*r/68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\left(0.5 \cdot h\right) \cdot \color{blue}{\frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}}\right)}^{2}\right) \]
      8. Applied egg-rr68.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{\left(0.5 \cdot h\right) \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right)}^{2}}\right) \]
      9. Taylor expanded in d around inf 40.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      10. Step-by-step derivation
        1. associate-/r*41.7%

          \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      11. Simplified41.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification40.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.8 \cdot 10^{-270}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 19: 43.1% accurate, 3.0× speedup?

    \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 2.8 \cdot 10^{-269}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \end{array} \]
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d h l M_m D_m)
     :precision binary64
     (if (<= d 2.8e-269)
       (* d (- (pow (* h l) -0.5)))
       (* d (sqrt (/ (/ 1.0 h) l)))))
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d < h && h < l && l < M_m && M_m < D_m);
    double code(double d, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (d <= 2.8e-269) {
    		tmp = d * -pow((h * l), -0.5);
    	} else {
    		tmp = d * sqrt(((1.0 / h) / l));
    	}
    	return tmp;
    }
    
    M_m = abs(m)
    D_m = abs(d)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    real(8) function code(d, h, l, m_m, d_m)
        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_m
        real(8) :: tmp
        if (d <= 2.8d-269) then
            tmp = d * -((h * l) ** (-0.5d0))
        else
            tmp = d * sqrt(((1.0d0 / h) / l))
        end if
        code = tmp
    end function
    
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (d <= 2.8e-269) {
    		tmp = d * -Math.pow((h * l), -0.5);
    	} else {
    		tmp = d * Math.sqrt(((1.0 / h) / l));
    	}
    	return tmp;
    }
    
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
    def code(d, h, l, M_m, D_m):
    	tmp = 0
    	if d <= 2.8e-269:
    		tmp = d * -math.pow((h * l), -0.5)
    	else:
    		tmp = d * math.sqrt(((1.0 / h) / l))
    	return tmp
    
    M_m = abs(M)
    D_m = abs(D)
    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
    function code(d, h, l, M_m, D_m)
    	tmp = 0.0
    	if (d <= 2.8e-269)
    		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
    	else
    		tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l)));
    	end
    	return tmp
    end
    
    M_m = abs(M);
    D_m = abs(D);
    d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
    function tmp_2 = code(d, h, l, M_m, D_m)
    	tmp = 0.0;
    	if (d <= 2.8e-269)
    		tmp = d * -((h * l) ^ -0.5);
    	else
    		tmp = d * sqrt(((1.0 / h) / l));
    	end
    	tmp_2 = tmp;
    end
    
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 2.8e-269], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $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_m = \left|D\right|
    \\
    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;d \leq 2.8 \cdot 10^{-269}:\\
    \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if d < 2.79999999999999995e-269

      1. Initial program 56.7%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified55.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in d around inf 6.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. Taylor expanded in h around -inf 0.0%

        \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      6. Step-by-step derivation
        1. associate-*l*0.0%

          \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
        2. unpow20.0%

          \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
        3. rem-square-sqrt37.4%

          \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
        4. mul-1-neg37.4%

          \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
        5. unpow-137.4%

          \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
        6. metadata-eval37.4%

          \[\leadsto d \cdot \left(-\sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
        7. pow-sqr37.5%

          \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
        8. rem-sqrt-square37.5%

          \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
        9. rem-square-sqrt37.3%

          \[\leadsto d \cdot \left(-\left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \]
        10. fabs-sqr37.3%

          \[\leadsto d \cdot \left(-\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
        11. rem-square-sqrt37.5%

          \[\leadsto d \cdot \left(-\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \]
      7. Simplified37.5%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

      if 2.79999999999999995e-269 < d

      1. Initial program 66.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. Simplified68.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. Taylor expanded in M around 0 37.6%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*39.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell}\right)\right) \]
        2. times-frac39.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)}\right)\right) \]
        3. associate-/l*41.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        4. *-commutative41.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\frac{{M}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        5. unpow241.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        6. unpow241.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        7. times-frac53.8%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\left(\frac{M}{d} \cdot \frac{M}{d}\right)} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        8. unpow253.8%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        9. swap-sqr67.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        10. associate-/r/67.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        11. associate-/r/68.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        12. unpow268.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
        13. associate-*l*68.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)}\right) \]
        14. *-commutative68.2%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)\right)}\right) \]
        15. associate-*l/66.0%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}{\ell}}\right) \]
        16. associate-/l*68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right) \]
        17. associate-/l*68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \color{blue}{\left(0.25 \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right)\right) \]
      6. Simplified68.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right) \]
      7. Step-by-step derivation
        1. add-sqr-sqrt68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)} \cdot \sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}}\right) \]
        2. pow268.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right)}^{2}}\right) \]
        3. associate-*r*68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left(0.5 \cdot h\right) \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}}\right)}^{2}\right) \]
        4. associate-*r/68.3%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\left(0.5 \cdot h\right) \cdot \color{blue}{\frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}}\right)}^{2}\right) \]
      8. Applied egg-rr68.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{\left(0.5 \cdot h\right) \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right)}^{2}}\right) \]
      9. Taylor expanded in d around inf 40.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      10. Step-by-step derivation
        1. associate-/r*41.7%

          \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      11. Simplified41.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 20: 43.0% accurate, 3.0× speedup?

    \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 2 \cdot 10^{-269}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \end{array} \]
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d h l M_m D_m)
     :precision binary64
     (if (<= d 2e-269) (* d (- (pow (* h l) -0.5))) (/ d (sqrt (* h l)))))
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d < h && h < l && l < M_m && M_m < D_m);
    double code(double d, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (d <= 2e-269) {
    		tmp = d * -pow((h * l), -0.5);
    	} else {
    		tmp = d / sqrt((h * l));
    	}
    	return tmp;
    }
    
    M_m = abs(m)
    D_m = abs(d)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    real(8) function code(d, h, l, m_m, d_m)
        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_m
        real(8) :: tmp
        if (d <= 2d-269) then
            tmp = d * -((h * l) ** (-0.5d0))
        else
            tmp = d / sqrt((h * l))
        end if
        code = tmp
    end function
    
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (d <= 2e-269) {
    		tmp = d * -Math.pow((h * l), -0.5);
    	} else {
    		tmp = d / Math.sqrt((h * l));
    	}
    	return tmp;
    }
    
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
    def code(d, h, l, M_m, D_m):
    	tmp = 0
    	if d <= 2e-269:
    		tmp = d * -math.pow((h * l), -0.5)
    	else:
    		tmp = d / math.sqrt((h * l))
    	return tmp
    
    M_m = abs(M)
    D_m = abs(D)
    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
    function code(d, h, l, M_m, D_m)
    	tmp = 0.0
    	if (d <= 2e-269)
    		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
    	else
    		tmp = Float64(d / sqrt(Float64(h * l)));
    	end
    	return tmp
    end
    
    M_m = abs(M);
    D_m = abs(D);
    d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
    function tmp_2 = code(d, h, l, M_m, D_m)
    	tmp = 0.0;
    	if (d <= 2e-269)
    		tmp = d * -((h * l) ^ -0.5);
    	else
    		tmp = d / sqrt((h * l));
    	end
    	tmp_2 = tmp;
    end
    
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 2e-269], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;d \leq 2 \cdot 10^{-269}:\\
    \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if d < 1.9999999999999999e-269

      1. Initial program 56.7%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified55.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in d around inf 6.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. Taylor expanded in h around -inf 0.0%

        \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      6. Step-by-step derivation
        1. associate-*l*0.0%

          \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
        2. unpow20.0%

          \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
        3. rem-square-sqrt37.4%

          \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
        4. mul-1-neg37.4%

          \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
        5. unpow-137.4%

          \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
        6. metadata-eval37.4%

          \[\leadsto d \cdot \left(-\sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
        7. pow-sqr37.5%

          \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
        8. rem-sqrt-square37.5%

          \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
        9. rem-square-sqrt37.3%

          \[\leadsto d \cdot \left(-\left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \]
        10. fabs-sqr37.3%

          \[\leadsto d \cdot \left(-\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
        11. rem-square-sqrt37.5%

          \[\leadsto d \cdot \left(-\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \]
      7. Simplified37.5%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

      if 1.9999999999999999e-269 < d

      1. Initial program 66.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. Simplified68.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in d around inf 40.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. Step-by-step derivation
        1. sqrt-div40.7%

          \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
        2. metadata-eval40.7%

          \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
        3. sqrt-unprod54.9%

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv55.0%

          \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        5. sqrt-unprod40.7%

          \[\leadsto \frac{d}{\color{blue}{\sqrt{h \cdot \ell}}} \]
      6. Applied egg-rr40.7%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 21: 43.0% accurate, 3.0× speedup?

    \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{h \cdot \ell}\\ \mathbf{if}\;d \leq 2.6 \cdot 10^{-269}:\\ \;\;\;\;\frac{-d}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{t\_0}\\ \end{array} \end{array} \]
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d h l M_m D_m)
     :precision binary64
     (let* ((t_0 (sqrt (* h l)))) (if (<= d 2.6e-269) (/ (- d) t_0) (/ d t_0))))
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d < h && h < l && l < M_m && M_m < D_m);
    double code(double d, double h, double l, double M_m, double D_m) {
    	double t_0 = sqrt((h * l));
    	double tmp;
    	if (d <= 2.6e-269) {
    		tmp = -d / t_0;
    	} else {
    		tmp = d / t_0;
    	}
    	return tmp;
    }
    
    M_m = abs(m)
    D_m = abs(d)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    real(8) function code(d, h, l, m_m, d_m)
        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_m
        real(8) :: t_0
        real(8) :: tmp
        t_0 = sqrt((h * l))
        if (d <= 2.6d-269) then
            tmp = -d / t_0
        else
            tmp = d / t_0
        end if
        code = tmp
    end function
    
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d, double h, double l, double M_m, double D_m) {
    	double t_0 = Math.sqrt((h * l));
    	double tmp;
    	if (d <= 2.6e-269) {
    		tmp = -d / t_0;
    	} else {
    		tmp = d / t_0;
    	}
    	return tmp;
    }
    
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
    def code(d, h, l, M_m, D_m):
    	t_0 = math.sqrt((h * l))
    	tmp = 0
    	if d <= 2.6e-269:
    		tmp = -d / t_0
    	else:
    		tmp = d / t_0
    	return tmp
    
    M_m = abs(M)
    D_m = abs(D)
    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
    function code(d, h, l, M_m, D_m)
    	t_0 = sqrt(Float64(h * l))
    	tmp = 0.0
    	if (d <= 2.6e-269)
    		tmp = Float64(Float64(-d) / t_0);
    	else
    		tmp = Float64(d / t_0);
    	end
    	return tmp
    end
    
    M_m = abs(M);
    D_m = abs(D);
    d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
    function tmp_2 = code(d, h, l, M_m, D_m)
    	t_0 = sqrt((h * l));
    	tmp = 0.0;
    	if (d <= 2.6e-269)
    		tmp = -d / t_0;
    	else
    		tmp = d / t_0;
    	end
    	tmp_2 = tmp;
    end
    
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 2.6e-269], N[((-d) / t$95$0), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]
    
    \begin{array}{l}
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    t_0 := \sqrt{h \cdot \ell}\\
    \mathbf{if}\;d \leq 2.6 \cdot 10^{-269}:\\
    \;\;\;\;\frac{-d}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{d}{t\_0}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if d < 2.6e-269

      1. Initial program 56.7%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Simplified56.0%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in M around 0 41.2%

        \[\leadsto \left(\sqrt{\frac{d}{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) \]
      5. Step-by-step derivation
        1. associate-*r*41.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell}\right)\right) \]
        2. times-frac38.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h}{\ell}\right)}\right)\right) \]
        3. associate-/l*38.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        4. *-commutative38.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\frac{{M}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        5. unpow238.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        6. unpow238.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        7. times-frac45.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\left(\frac{M}{d} \cdot \frac{M}{d}\right)} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        8. unpow245.5%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        9. swap-sqr56.8%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
        10. associate-/r/55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        11. associate-/r/55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\left(\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
        12. unpow255.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
        13. associate-*l*55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)}\right) \]
        14. *-commutative55.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)\right)}\right) \]
        15. associate-*l/58.4%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}{\ell}}\right) \]
        16. associate-/l*59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right) \]
        17. associate-/l*59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \color{blue}{\left(0.25 \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell}\right)}\right)\right) \]
      6. Simplified60.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right) \]
      7. Step-by-step derivation
        1. add-sqr-sqrt59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)} \cdot \sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}}\right) \]
        2. pow259.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}\right)}^{2}}\right) \]
        3. associate-*r*59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left(0.5 \cdot h\right) \cdot \left(0.25 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}}\right)}^{2}\right) \]
        4. associate-*r/59.9%

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\sqrt{\left(0.5 \cdot h\right) \cdot \color{blue}{\frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}}\right)}^{2}\right) \]
      8. Applied egg-rr59.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{\left(0.5 \cdot h\right) \cdot \frac{0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right)}^{2}}\right) \]
      9. Taylor expanded in l around -inf 0.0%

        \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      10. Step-by-step derivation
        1. associate-*l*0.0%

          \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
        2. unpow20.0%

          \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
        3. rem-square-sqrt37.4%

          \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
        4. mul-1-neg37.4%

          \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
        5. distribute-rgt-neg-out37.4%

          \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
        6. *-commutative37.4%

          \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      11. Simplified37.4%

        \[\leadsto \color{blue}{-\frac{d}{\sqrt{h \cdot \ell}}} \]

      if 2.6e-269 < d

      1. Initial program 66.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. Simplified68.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
      3. Add Preprocessing
      4. Taylor expanded in d around inf 40.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. Step-by-step derivation
        1. sqrt-div40.7%

          \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
        2. metadata-eval40.7%

          \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
        3. sqrt-unprod54.9%

          \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        4. div-inv55.0%

          \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        5. sqrt-unprod40.7%

          \[\leadsto \frac{d}{\color{blue}{\sqrt{h \cdot \ell}}} \]
      6. Applied egg-rr40.7%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification39.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 2.6 \cdot 10^{-269}:\\ \;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 22: 25.8% accurate, 3.2× speedup?

    \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \frac{d}{\sqrt{h \cdot \ell}} \end{array} \]
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* h l))))
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d < h && h < l && l < M_m && M_m < D_m);
    double code(double d, double h, double l, double M_m, double D_m) {
    	return d / sqrt((h * l));
    }
    
    M_m = abs(m)
    D_m = abs(d)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    real(8) function code(d, h, l, m_m, d_m)
        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_m
        code = d / sqrt((h * l))
    end function
    
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d, double h, double l, double M_m, double D_m) {
    	return d / Math.sqrt((h * l));
    }
    
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
    def code(d, h, l, M_m, D_m):
    	return d / math.sqrt((h * l))
    
    M_m = abs(M)
    D_m = abs(D)
    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
    function code(d, h, l, M_m, D_m)
    	return Float64(d / sqrt(Float64(h * l)))
    end
    
    M_m = abs(M);
    D_m = abs(D);
    d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
    function tmp = code(d, h, l, M_m, D_m)
    	tmp = d / sqrt((h * l));
    end
    
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
    \\
    \frac{d}{\sqrt{h \cdot \ell}}
    \end{array}
    
    Derivation
    1. Initial program 61.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified62.0%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 23.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div23.1%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval23.1%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
      3. sqrt-unprod27.8%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      4. div-inv27.8%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      5. sqrt-unprod23.1%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h \cdot \ell}}} \]
    6. Applied egg-rr23.1%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    7. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2024181 
    (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)))))