Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.7% → 84.0%
Time: 26.4s
Alternatives: 22
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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


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

    1. Initial program 61.7%

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

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

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

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

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

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

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

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

    if -2.8000000000000001e-99 < l < -1.999999999999994e-310

    1. Initial program 76.4%

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 67.8%

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

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

        \[\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*43.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. *-commutative43.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. unpow243.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. unpow243.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-frac56.0%

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

        \[\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.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/65.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}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      11. associate-/r/65.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}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      12. unpow265.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}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
      13. associate-*l*65.5%

        \[\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. *-commutative65.5%

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

        \[\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.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. *-commutative68.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2} \cdot 0.25}}{\ell}\right)\right) \]
    6. Simplified71.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({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)}\right) \]
    7. Step-by-step derivation
      1. *-commutative71.0%

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

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

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

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

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

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

Alternative 2: 79.3% 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}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot \left(0.25 \cdot {\left(\frac{M\_m}{\frac{d}{D\_m}}\right)}^{2}\right)\right)}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\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 -2e-310)
   (*
    (/ (sqrt (- d)) (sqrt (- l)))
    (*
     (sqrt (/ d h))
     (+ 1.0 (/ (* h (* -0.5 (* 0.25 (pow (/ M_m (/ d D_m)) 2.0)))) l))))
   (*
    (/ d (* (sqrt l) (sqrt h)))
    (- 1.0 (* 0.5 (* h (* (pow (* D_m (/ M_m d)) 2.0) (/ 0.25 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 (h <= -2e-310) {
		tmp = (sqrt(-d) / sqrt(-l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * (0.25 * pow((M_m / (d / D_m)), 2.0)))) / l)));
	} else {
		tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * (h * (pow((D_m * (M_m / d)), 2.0) * (0.25 / 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 (h <= (-2d-310)) then
        tmp = (sqrt(-d) / sqrt(-l)) * (sqrt((d / h)) * (1.0d0 + ((h * ((-0.5d0) * (0.25d0 * ((m_m / (d / d_m)) ** 2.0d0)))) / l)))
    else
        tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.5d0 * (h * (((d_m * (m_m / d)) ** 2.0d0) * (0.25d0 / 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 (h <= -2e-310) {
		tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * (0.25 * Math.pow((M_m / (d / D_m)), 2.0)))) / l)));
	} else {
		tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.5 * (h * (Math.pow((D_m * (M_m / d)), 2.0) * (0.25 / 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 h <= -2e-310:
		tmp = (math.sqrt(-d) / math.sqrt(-l)) * (math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * (0.25 * math.pow((M_m / (d / D_m)), 2.0)))) / l)))
	else:
		tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.5 * (h * (math.pow((D_m * (M_m / d)), 2.0) * (0.25 / 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 (h <= -2e-310)
		tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * Float64(0.25 * (Float64(M_m / Float64(d / D_m)) ^ 2.0)))) / l))));
	else
		tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(0.25 / 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 (h <= -2e-310)
		tmp = (sqrt(-d) / sqrt(-l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * (0.25 * ((M_m / (d / D_m)) ^ 2.0)))) / l)));
	else
		tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * (h * (((D_m * (M_m / d)) ^ 2.0) * (0.25 / 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[h, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[(0.25 * N[Power[N[(M$95$m / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.25 / l), $MachinePrecision]), $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 -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot \left(0.25 \cdot {\left(\frac{M\_m}{\frac{d}{D\_m}}\right)}^{2}\right)\right)}{\ell}\right)\right)\\

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


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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < h

    1. Initial program 67.8%

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

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

        \[\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*43.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. *-commutative43.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. unpow243.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. unpow243.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-frac56.0%

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

        \[\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.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/65.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}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      11. associate-/r/65.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}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      12. unpow265.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}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
      13. associate-*l*65.5%

        \[\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. *-commutative65.5%

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

        \[\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.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. *-commutative68.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2} \cdot 0.25}}{\ell}\right)\right) \]
    6. Simplified71.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({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)}\right) \]
    7. Step-by-step derivation
      1. *-commutative71.0%

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

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

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

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

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

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

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

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

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


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

    1. Initial program 46.9%

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

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

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

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

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

    if -7.5999999999999997e124 < l < -1.999999999999994e-310

    1. Initial program 74.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. Simplified75.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 47.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*48.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-frac49.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*47.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. *-commutative47.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. unpow247.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. unpow247.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-frac59.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. unpow259.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-sqr74.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/74.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/75.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. unpow275.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*75.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. *-commutative75.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/77.5%

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

        \[\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. *-commutative76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 67.8%

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

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

        \[\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*43.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. *-commutative43.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. unpow243.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. unpow243.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-frac56.0%

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

        \[\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.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/65.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}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      11. associate-/r/65.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}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      12. unpow265.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}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
      13. associate-*l*65.5%

        \[\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. *-commutative65.5%

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

        \[\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.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. *-commutative68.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2} \cdot 0.25}}{\ell}\right)\right) \]
    6. Simplified71.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({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)}\right) \]
    7. Step-by-step derivation
      1. *-commutative71.0%

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 83.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. Simplified81.8%

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

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

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

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

    if -1.85000000000000003e-19 < d < -3.999999999999988e-310

    1. Initial program 49.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. Simplified50.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. Taylor expanded in M around 0 30.0%

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

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

        \[\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*31.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({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      4. *-commutative31.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}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      5. unpow231.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{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      6. unpow231.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 \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      7. times-frac39.0%

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

        \[\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-sqr50.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(\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/50.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}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      11. associate-/r/50.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}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      12. unpow250.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}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
      13. associate-*l*50.5%

        \[\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. *-commutative50.5%

        \[\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/52.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.999999999999988e-310 < d

    1. Initial program 67.8%

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

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

        \[\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*43.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. *-commutative43.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. unpow243.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. unpow243.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-frac56.0%

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

        \[\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.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/65.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}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      11. associate-/r/65.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}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      12. unpow265.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}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
      13. associate-*l*65.5%

        \[\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. *-commutative65.5%

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

        \[\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.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. *-commutative68.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2} \cdot 0.25}}{\ell}\right)\right) \]
    6. Simplified71.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({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)}\right) \]
    7. Step-by-step derivation
      1. *-commutative71.0%

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

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

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

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

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

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

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

Alternative 5: 76.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 -1.55 \cdot 10^{+194}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(0.5 \cdot \left(h \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+122}:\\ \;\;\;\;d \cdot \left({\left(\ell \cdot h\right)}^{-0.5} \cdot \mathsf{fma}\left(\frac{0.25}{\ell}, \left(h \cdot -0.5\right) \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\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 (<= l -1.55e+194)
   (* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
   (if (<= l -2e-310)
     (*
      (* d (sqrt (/ 1.0 (* l h))))
      (+ (* 0.5 (* h (* (pow (* D_m (/ M_m d)) 2.0) (/ 0.25 l)))) -1.0))
     (if (<= l 3.2e+122)
       (*
        d
        (*
         (pow (* l h) -0.5)
         (fma (/ 0.25 l) (* (* h -0.5) (pow (/ (* D_m M_m) d) 2.0)) 1.0)))
       (* d (* (pow l -0.5) (pow h -0.5)))))))
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.55e+194) {
		tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
	} else if (l <= -2e-310) {
		tmp = (d * sqrt((1.0 / (l * h)))) * ((0.5 * (h * (pow((D_m * (M_m / d)), 2.0) * (0.25 / l)))) + -1.0);
	} else if (l <= 3.2e+122) {
		tmp = d * (pow((l * h), -0.5) * fma((0.25 / l), ((h * -0.5) * pow(((D_m * M_m) / d), 2.0)), 1.0));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	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.55e+194)
		tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h)));
	elseif (l <= -2e-310)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(0.5 * Float64(h * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(0.25 / l)))) + -1.0));
	elseif (l <= 3.2e+122)
		tmp = Float64(d * Float64((Float64(l * h) ^ -0.5) * fma(Float64(0.25 / l), Float64(Float64(h * -0.5) * (Float64(Float64(D_m * M_m) / d) ^ 2.0)), 1.0)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	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_] := If[LessEqual[l, -1.55e+194], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.25 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.2e+122], N[(d * N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.55 \cdot 10^{+194}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\

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

\mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+122}:\\
\;\;\;\;d \cdot \left({\left(\ell \cdot h\right)}^{-0.5} \cdot \mathsf{fma}\left(\frac{0.25}{\ell}, \left(h \cdot -0.5\right) \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}, 1\right)\right)\\

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


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

    1. Initial program 37.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. Simplified37.5%

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

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

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

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

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

    if -1.55e194 < l < -1.999999999999994e-310

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

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

      \[\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*45.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-frac46.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*44.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({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      4. *-commutative44.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(\frac{{M}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      5. unpow244.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(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      6. unpow244.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(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      7. times-frac57.0%

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

        \[\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-sqr72.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/72.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/73.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. unpow273.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*73.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. *-commutative73.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/74.5%

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

        \[\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. *-commutative74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l < 3.20000000000000012e122

    1. Initial program 74.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/251.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \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} \]
      3. metadata-eval76.4%

        \[\leadsto {\left(\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \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} \]
      4. div-inv76.4%

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

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

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

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

    if 3.20000000000000012e122 < l

    1. Initial program 53.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. Simplified48.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down75.0%

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

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

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

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

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

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


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

    1. Initial program 59.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. Simplified59.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 31.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*33.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-frac31.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*28.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({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      4. *-commutative28.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}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      5. unpow228.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{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      6. unpow228.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 \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      7. times-frac42.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. unpow242.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-sqr59.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(\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/59.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/59.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. unpow259.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*59.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. *-commutative59.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/62.7%

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

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

    if -2.5499999999999999e125 < h < -1.999999999999994e-310

    1. Initial program 69.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/251.0%

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

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

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

    if -1.999999999999994e-310 < h

    1. Initial program 67.8%

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

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

        \[\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*43.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. *-commutative43.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. unpow243.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. unpow243.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-frac56.0%

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

        \[\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.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/65.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}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      11. associate-/r/65.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}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      12. unpow265.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}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
      13. associate-*l*65.5%

        \[\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. *-commutative65.5%

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

        \[\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.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. *-commutative68.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2} \cdot 0.25}}{\ell}\right)\right) \]
    6. Simplified71.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({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)}\right) \]
    7. Step-by-step derivation
      1. *-commutative71.0%

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 37.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. Simplified37.5%

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

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

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

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

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

    if -6.50000000000000052e179 < l < -1.999999999999994e-310

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

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

      \[\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*45.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-frac46.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*44.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({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      4. *-commutative44.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(\frac{{M}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      5. unpow244.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(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      6. unpow244.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(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      7. times-frac57.0%

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

        \[\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-sqr72.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/72.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/73.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. unpow273.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*73.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. *-commutative73.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/74.5%

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

        \[\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. *-commutative74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 67.8%

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

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

        \[\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*43.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. *-commutative43.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. unpow243.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. unpow243.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-frac56.0%

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

        \[\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.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/65.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}{\frac{M}{\frac{d}{D}}} \cdot \left(\frac{M}{d} \cdot D\right)\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      11. associate-/r/65.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}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      12. unpow265.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}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
      13. associate-*l*65.5%

        \[\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. *-commutative65.5%

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

        \[\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.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. *-commutative68.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2} \cdot 0.25}}{\ell}\right)\right) \]
    6. Simplified71.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({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)}\right) \]
    7. Step-by-step derivation
      1. *-commutative71.0%

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

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

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

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

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

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

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

Alternative 8: 76.1% accurate, 1.1× 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 := 0.5 \cdot \left(h \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)\\ \mathbf{if}\;\ell \leq -2.5 \cdot 10^{+181}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(t\_0 + -1\right)\\ \mathbf{elif}\;\ell \leq 9 \cdot 10^{+153}:\\ \;\;\;\;\left(1 - t\_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\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 (* 0.5 (* h (* (pow (* D_m (/ M_m d)) 2.0) (/ 0.25 l))))))
   (if (<= l -2.5e+181)
     (* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
     (if (<= l -2e-310)
       (* (* d (sqrt (/ 1.0 (* l h)))) (+ t_0 -1.0))
       (if (<= l 9e+153)
         (* (- 1.0 t_0) (* d (pow (* l h) -0.5)))
         (* d (* (pow l -0.5) (pow h -0.5))))))))
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 = 0.5 * (h * (pow((D_m * (M_m / d)), 2.0) * (0.25 / l)));
	double tmp;
	if (l <= -2.5e+181) {
		tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
	} else if (l <= -2e-310) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (t_0 + -1.0);
	} else if (l <= 9e+153) {
		tmp = (1.0 - t_0) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	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 = 0.5d0 * (h * (((d_m * (m_m / d)) ** 2.0d0) * (0.25d0 / l)))
    if (l <= (-2.5d+181)) then
        tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h))
    else if (l <= (-2d-310)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (t_0 + (-1.0d0))
    else if (l <= 9d+153) then
        tmp = (1.0d0 - t_0) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    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 = 0.5 * (h * (Math.pow((D_m * (M_m / d)), 2.0) * (0.25 / l)));
	double tmp;
	if (l <= -2.5e+181) {
		tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h));
	} else if (l <= -2e-310) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (t_0 + -1.0);
	} else if (l <= 9e+153) {
		tmp = (1.0 - t_0) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	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 = 0.5 * (h * (math.pow((D_m * (M_m / d)), 2.0) * (0.25 / l)))
	tmp = 0
	if l <= -2.5e+181:
		tmp = (math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h))
	elif l <= -2e-310:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (t_0 + -1.0)
	elif l <= 9e+153:
		tmp = (1.0 - t_0) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	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(0.5 * Float64(h * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(0.25 / l))))
	tmp = 0.0
	if (l <= -2.5e+181)
		tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h)));
	elseif (l <= -2e-310)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(t_0 + -1.0));
	elseif (l <= 9e+153)
		tmp = Float64(Float64(1.0 - t_0) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	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 = 0.5 * (h * (((D_m * (M_m / d)) ^ 2.0) * (0.25 / l)));
	tmp = 0.0;
	if (l <= -2.5e+181)
		tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
	elseif (l <= -2e-310)
		tmp = (d * sqrt((1.0 / (l * h)))) * (t_0 + -1.0);
	elseif (l <= 9e+153)
		tmp = (1.0 - t_0) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	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[(0.5 * N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.25 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.5e+181], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9e+153], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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 := 0.5 \cdot \left(h \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)\\
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+181}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\

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

\mathbf{elif}\;\ell \leq 9 \cdot 10^{+153}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


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

    1. Initial program 37.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. Simplified37.5%

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

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

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

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

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

    if -2.5000000000000002e181 < l < -1.999999999999994e-310

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

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

      \[\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*45.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-frac46.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*44.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({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      4. *-commutative44.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(\frac{{M}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      5. unpow244.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(\frac{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      6. unpow244.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(\frac{M \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      7. times-frac57.0%

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

        \[\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-sqr72.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/72.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/73.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. unpow273.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*73.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. *-commutative73.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/74.5%

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

        \[\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. *-commutative74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l < 9.0000000000000002e153

    1. Initial program 73.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. Simplified71.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. sqrt-unprod62.9%

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/250.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\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) \]
    12. Step-by-step derivation
      1. associate-*r*54.3%

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

        \[\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*50.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. *-commutative50.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. unpow250.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. unpow250.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-frac63.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. unpow263.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-sqr73.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/71.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/71.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. unpow271.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*71.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. *-commutative71.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/75.9%

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

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

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

    if 9.0000000000000002e153 < l

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down74.9%

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

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

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

Alternative 9: 61.8% 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.25 \cdot 10^{-174}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;\ell \leq -2.45 \cdot 10^{-293}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(\left(\frac{h}{\ell} \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}\right) \cdot -0.125\right)\\ \mathbf{elif}\;\ell \leq 9 \cdot 10^{+126}:\\ \;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(1 - 0.125 \cdot \frac{h \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\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 (<= l -1.25e-174)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (if (<= l -2.45e-293)
     (*
      (sqrt (* (/ d h) (/ d l)))
      (* (* (/ h l) (pow (/ (* D_m M_m) d) 2.0)) -0.125))
     (if (<= l 9e+126)
       (*
        (* d (pow (* l h) -0.5))
        (- 1.0 (* 0.125 (/ (* h (pow (* D_m (/ M_m d)) 2.0)) l))))
       (* d (* (pow l -0.5) (pow h -0.5)))))))
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.25e-174) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else if (l <= -2.45e-293) {
		tmp = sqrt(((d / h) * (d / l))) * (((h / l) * pow(((D_m * M_m) / d), 2.0)) * -0.125);
	} else if (l <= 9e+126) {
		tmp = (d * pow((l * h), -0.5)) * (1.0 - (0.125 * ((h * pow((D_m * (M_m / d)), 2.0)) / l)));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	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.25d-174)) then
        tmp = d * -sqrt(((1.0d0 / l) / h))
    else if (l <= (-2.45d-293)) then
        tmp = sqrt(((d / h) * (d / l))) * (((h / l) * (((d_m * m_m) / d) ** 2.0d0)) * (-0.125d0))
    else if (l <= 9d+126) then
        tmp = (d * ((l * h) ** (-0.5d0))) * (1.0d0 - (0.125d0 * ((h * ((d_m * (m_m / d)) ** 2.0d0)) / l)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    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.25e-174) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else if (l <= -2.45e-293) {
		tmp = Math.sqrt(((d / h) * (d / l))) * (((h / l) * Math.pow(((D_m * M_m) / d), 2.0)) * -0.125);
	} else if (l <= 9e+126) {
		tmp = (d * Math.pow((l * h), -0.5)) * (1.0 - (0.125 * ((h * Math.pow((D_m * (M_m / d)), 2.0)) / l)));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	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.25e-174:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	elif l <= -2.45e-293:
		tmp = math.sqrt(((d / h) * (d / l))) * (((h / l) * math.pow(((D_m * M_m) / d), 2.0)) * -0.125)
	elif l <= 9e+126:
		tmp = (d * math.pow((l * h), -0.5)) * (1.0 - (0.125 * ((h * math.pow((D_m * (M_m / d)), 2.0)) / l)))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	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.25e-174)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	elseif (l <= -2.45e-293)
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(Float64(Float64(h / l) * (Float64(Float64(D_m * M_m) / d) ^ 2.0)) * -0.125));
	elseif (l <= 9e+126)
		tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(1.0 - Float64(0.125 * Float64(Float64(h * (Float64(D_m * Float64(M_m / d)) ^ 2.0)) / l))));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	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.25e-174)
		tmp = d * -sqrt(((1.0 / l) / h));
	elseif (l <= -2.45e-293)
		tmp = sqrt(((d / h) * (d / l))) * (((h / l) * (((D_m * M_m) / d) ^ 2.0)) * -0.125);
	elseif (l <= 9e+126)
		tmp = (d * ((l * h) ^ -0.5)) * (1.0 - (0.125 * ((h * ((D_m * (M_m / d)) ^ 2.0)) / l)));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	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.25e-174], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2.45e-293], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9e+126], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.25 \cdot 10^{-174}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -1.2500000000000001e-174

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      14. fabs-sqr42.2%

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

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

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

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

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

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

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

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

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

    if -1.2500000000000001e-174 < l < -2.45e-293

    1. Initial program 87.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. Simplified91.8%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \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-frac41.8%

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-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)\right)\right) \]
      10. associate-/r/66.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.45e-293 < l < 8.99999999999999947e126

    1. Initial program 72.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/250.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\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-frac53.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.99999999999999947e126 < l

    1. Initial program 53.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. Simplified48.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down75.0%

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

      \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification63.5%

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

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

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

\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+153}:\\
\;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(1 - 0.125 \cdot t\_0\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -6.50000000000000012e-172

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
      14. fabs-sqr42.2%

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

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

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

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

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

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

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

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

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

    if -6.50000000000000012e-172 < l < -2.45e-293

    1. Initial program 87.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. Simplified91.8%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \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-frac41.8%

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-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)\right)\right) \]
      10. associate-/r/66.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.45e-293 < l < 1.64999999999999997e153

    1. Initial program 72.1%

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/249.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\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-frac54.0%

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

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

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

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

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

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

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

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

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

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

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

    if 1.64999999999999997e153 < l

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down74.9%

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

      \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification60.9%

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

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

\mathbf{elif}\;\ell \leq 7.2 \cdot 10^{+154}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


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

    1. Initial program 66.7%

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

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

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

        \[\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.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. *-commutative40.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. unpow240.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. unpow240.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-frac51.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. 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(\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-sqr66.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/66.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/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(\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      12. unpow267.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}{\frac{d}{D}}\right)}^{2}} \cdot \frac{h}{\ell}\right)\right)\right) \]
      13. associate-*l*67.4%

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

        \[\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/68.5%

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

        \[\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. *-commutative68.5%

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{d}{\ell}}\right)} - 1\right)}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)\right) \]
    9. Step-by-step derivation
      1. expm1-define66.4%

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l < 7.2000000000000001e154

    1. Initial program 73.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. Simplified71.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. sqrt-unprod62.9%

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/250.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\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) \]
    12. Step-by-step derivation
      1. associate-*r*54.3%

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

        \[\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*50.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. *-commutative50.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. unpow250.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. unpow250.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-frac63.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. unpow263.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-sqr73.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/71.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/71.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. unpow271.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*71.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. *-commutative71.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/75.9%

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

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

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

    if 7.2000000000000001e154 < l

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down74.9%

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

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

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

Alternative 12: 72.0% 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.45 \cdot 10^{-293}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 1.2 \cdot 10^{+153}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\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 (<= l -2.45e-293)
   (*
    (/ d (sqrt (* l h)))
    (+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
   (if (<= l 1.2e+153)
     (*
      (- 1.0 (* 0.5 (* h (* (pow (* D_m (/ M_m d)) 2.0) (/ 0.25 l)))))
      (* d (pow (* l h) -0.5)))
     (* d (* (pow l -0.5) (pow h -0.5))))))
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 <= -2.45e-293) {
		tmp = (d / sqrt((l * h))) * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
	} else if (l <= 1.2e+153) {
		tmp = (1.0 - (0.5 * (h * (pow((D_m * (M_m / d)), 2.0) * (0.25 / l))))) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	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 <= (-2.45d-293)) then
        tmp = (d / sqrt((l * h))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))))
    else if (l <= 1.2d+153) then
        tmp = (1.0d0 - (0.5d0 * (h * (((d_m * (m_m / d)) ** 2.0d0) * (0.25d0 / l))))) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    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 <= -2.45e-293) {
		tmp = (d / Math.sqrt((l * h))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))));
	} else if (l <= 1.2e+153) {
		tmp = (1.0 - (0.5 * (h * (Math.pow((D_m * (M_m / d)), 2.0) * (0.25 / l))))) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	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 <= -2.45e-293:
		tmp = (d / math.sqrt((l * h))) * (-1.0 + (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0))))
	elif l <= 1.2e+153:
		tmp = (1.0 - (0.5 * (h * (math.pow((D_m * (M_m / d)), 2.0) * (0.25 / l))))) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	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 <= -2.45e-293)
		tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0)))));
	elseif (l <= 1.2e+153)
		tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(0.25 / l))))) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	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 <= -2.45e-293)
		tmp = (d / sqrt((l * h))) * (-1.0 + (0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))));
	elseif (l <= 1.2e+153)
		tmp = (1.0 - (0.5 * (h * (((D_m * (M_m / d)) ^ 2.0) * (0.25 / l))))) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	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, -2.45e-293], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.2e+153], N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.25 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.45 \cdot 10^{-293}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\

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

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


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

    1. Initial program 67.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/243.7%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left|-d\right|}}{\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) \]
      4. rem-square-sqrt67.9%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{-d} \cdot \sqrt{-d}}\right|}{\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) \]
      5. fabs-sqr67.9%

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

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

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

    if -2.45e-293 < l < 1.19999999999999996e153

    1. Initial program 72.1%

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/249.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\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) \]
    12. Step-by-step derivation
      1. associate-*r*53.0%

        \[\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-frac50.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*49.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({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      4. *-commutative49.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}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      5. unpow249.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{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      6. unpow249.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 \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      7. times-frac61.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. unpow261.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-sqr72.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/70.0%

        \[\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/69.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. unpow269.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*69.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. *-commutative69.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/75.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*75.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. *-commutative75.3%

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

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

    if 1.19999999999999996e153 < l

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down74.9%

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

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

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

Alternative 13: 72.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}\;\ell \leq -2.45 \cdot 10^{-293}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 2.1 \cdot 10^{+155}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \frac{0.25}{\ell}\right)\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\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 (<= l -2.45e-293)
   (*
    (* d (sqrt (/ 1.0 (* l h))))
    (+ -1.0 (* 0.125 (* (/ h l) (pow (/ (* D_m M_m) d) 2.0)))))
   (if (<= l 2.1e+155)
     (*
      (- 1.0 (* 0.5 (* h (* (pow (* D_m (/ M_m d)) 2.0) (/ 0.25 l)))))
      (* d (pow (* l h) -0.5)))
     (* d (* (pow l -0.5) (pow h -0.5))))))
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 <= -2.45e-293) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.125 * ((h / l) * pow(((D_m * M_m) / d), 2.0))));
	} else if (l <= 2.1e+155) {
		tmp = (1.0 - (0.5 * (h * (pow((D_m * (M_m / d)), 2.0) * (0.25 / l))))) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	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 <= (-2.45d-293)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.125d0 * ((h / l) * (((d_m * m_m) / d) ** 2.0d0))))
    else if (l <= 2.1d+155) then
        tmp = (1.0d0 - (0.5d0 * (h * (((d_m * (m_m / d)) ** 2.0d0) * (0.25d0 / l))))) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    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 <= -2.45e-293) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.125 * ((h / l) * Math.pow(((D_m * M_m) / d), 2.0))));
	} else if (l <= 2.1e+155) {
		tmp = (1.0 - (0.5 * (h * (Math.pow((D_m * (M_m / d)), 2.0) * (0.25 / l))))) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	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 <= -2.45e-293:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.125 * ((h / l) * math.pow(((D_m * M_m) / d), 2.0))))
	elif l <= 2.1e+155:
		tmp = (1.0 - (0.5 * (h * (math.pow((D_m * (M_m / d)), 2.0) * (0.25 / l))))) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	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 <= -2.45e-293)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.125 * Float64(Float64(h / l) * (Float64(Float64(D_m * M_m) / d) ^ 2.0)))));
	elseif (l <= 2.1e+155)
		tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(0.25 / l))))) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	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 <= -2.45e-293)
		tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.125 * ((h / l) * (((D_m * M_m) / d) ^ 2.0))));
	elseif (l <= 2.1e+155)
		tmp = (1.0 - (0.5 * (h * (((D_m * (M_m / d)) ^ 2.0) * (0.25 / l))))) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	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, -2.45e-293], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.1e+155], N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.25 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.45 \cdot 10^{-293}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}\right)\right)\\

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

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


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

    1. Initial program 67.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/243.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\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-frac0.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.45e-293 < l < 2.1e155

    1. Initial program 72.1%

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/249.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\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) \]
    12. Step-by-step derivation
      1. associate-*r*53.0%

        \[\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-frac50.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*49.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({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      4. *-commutative49.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}^{2}}{{d}^{2}} \cdot {D}^{2}\right)} \cdot \frac{h}{\ell}\right)\right)\right) \]
      5. unpow249.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{\color{blue}{M \cdot M}}{{d}^{2}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      6. unpow249.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 \cdot M}{\color{blue}{d \cdot d}} \cdot {D}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\right) \]
      7. times-frac61.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. unpow261.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-sqr72.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/70.0%

        \[\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/69.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. unpow269.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*69.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. *-commutative69.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/75.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*75.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. *-commutative75.3%

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

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

    if 2.1e155 < l

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down74.9%

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

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

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

Alternative 14: 72.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 -2.45 \cdot 10^{-293}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 5.7 \cdot 10^{+122}:\\ \;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(1 - 0.125 \cdot \frac{h \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\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 (<= l -2.45e-293)
   (*
    (* d (sqrt (/ 1.0 (* l h))))
    (+ -1.0 (* 0.125 (* (/ h l) (pow (/ (* D_m M_m) d) 2.0)))))
   (if (<= l 5.7e+122)
     (*
      (* d (pow (* l h) -0.5))
      (- 1.0 (* 0.125 (/ (* h (pow (* D_m (/ M_m d)) 2.0)) l))))
     (* d (* (pow l -0.5) (pow h -0.5))))))
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 <= -2.45e-293) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.125 * ((h / l) * pow(((D_m * M_m) / d), 2.0))));
	} else if (l <= 5.7e+122) {
		tmp = (d * pow((l * h), -0.5)) * (1.0 - (0.125 * ((h * pow((D_m * (M_m / d)), 2.0)) / l)));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	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 <= (-2.45d-293)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.125d0 * ((h / l) * (((d_m * m_m) / d) ** 2.0d0))))
    else if (l <= 5.7d+122) then
        tmp = (d * ((l * h) ** (-0.5d0))) * (1.0d0 - (0.125d0 * ((h * ((d_m * (m_m / d)) ** 2.0d0)) / l)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    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 <= -2.45e-293) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.125 * ((h / l) * Math.pow(((D_m * M_m) / d), 2.0))));
	} else if (l <= 5.7e+122) {
		tmp = (d * Math.pow((l * h), -0.5)) * (1.0 - (0.125 * ((h * Math.pow((D_m * (M_m / d)), 2.0)) / l)));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	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 <= -2.45e-293:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.125 * ((h / l) * math.pow(((D_m * M_m) / d), 2.0))))
	elif l <= 5.7e+122:
		tmp = (d * math.pow((l * h), -0.5)) * (1.0 - (0.125 * ((h * math.pow((D_m * (M_m / d)), 2.0)) / l)))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	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 <= -2.45e-293)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.125 * Float64(Float64(h / l) * (Float64(Float64(D_m * M_m) / d) ^ 2.0)))));
	elseif (l <= 5.7e+122)
		tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(1.0 - Float64(0.125 * Float64(Float64(h * (Float64(D_m * Float64(M_m / d)) ^ 2.0)) / l))));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	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 <= -2.45e-293)
		tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.125 * ((h / l) * (((D_m * M_m) / d) ^ 2.0))));
	elseif (l <= 5.7e+122)
		tmp = (d * ((l * h) ^ -0.5)) * (1.0 - (0.125 * ((h * ((D_m * (M_m / d)) ^ 2.0)) / l)));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	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, -2.45e-293], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.7e+122], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.45 \cdot 10^{-293}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}\right)\right)\\

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

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


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

    1. Initial program 67.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/243.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\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-frac0.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.45e-293 < l < 5.70000000000000006e122

    1. Initial program 72.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{{d}^{2}}{h \cdot \ell}\right)}^{0.5}} \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. unpow1/250.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\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-frac53.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.70000000000000006e122 < l

    1. Initial program 53.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. Simplified48.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down75.0%

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

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

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

Alternative 15: 51.6% 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}\;M\_m \leq 1.04 \cdot 10^{-63}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\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 (<= M_m 1.04e-63)
   (* (sqrt (/ d h)) (sqrt (/ d l)))
   (*
    (sqrt (* (/ d h) (/ d l)))
    (* (pow (* D_m (/ M_m d)) 2.0) (* (/ h l) -0.125)))))
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 (M_m <= 1.04e-63) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else {
		tmp = sqrt(((d / h) * (d / l))) * (pow((D_m * (M_m / d)), 2.0) * ((h / l) * -0.125));
	}
	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 (m_m <= 1.04d-63) then
        tmp = sqrt((d / h)) * sqrt((d / l))
    else
        tmp = sqrt(((d / h) * (d / l))) * (((d_m * (m_m / d)) ** 2.0d0) * ((h / l) * (-0.125d0)))
    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 (M_m <= 1.04e-63) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else {
		tmp = Math.sqrt(((d / h) * (d / l))) * (Math.pow((D_m * (M_m / d)), 2.0) * ((h / l) * -0.125));
	}
	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 M_m <= 1.04e-63:
		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
	else:
		tmp = math.sqrt(((d / h) * (d / l))) * (math.pow((D_m * (M_m / d)), 2.0) * ((h / l) * -0.125))
	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 (M_m <= 1.04e-63)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	else
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(Float64(h / l) * -0.125)));
	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 (M_m <= 1.04e-63)
		tmp = sqrt((d / h)) * sqrt((d / l));
	else
		tmp = sqrt(((d / h) * (d / l))) * (((D_m * (M_m / d)) ^ 2.0) * ((h / l) * -0.125));
	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[M$95$m, 1.04e-63], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.125), $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}\;M\_m \leq 1.04 \cdot 10^{-63}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 1.04e-63

    1. Initial program 65.0%

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

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

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

    if 1.04e-63 < M

    1. Initial program 73.6%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \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-frac39.7%

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-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)\right)\right) \]
      10. associate-/r/57.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \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/57.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \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. unpow257.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 51.5% 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}\;M\_m \leq 5.2 \cdot 10^{-64}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(\left(\frac{h}{\ell} \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}\right) \cdot -0.125\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 (<= M_m 5.2e-64)
   (* (sqrt (/ d h)) (sqrt (/ d l)))
   (*
    (sqrt (* (/ d h) (/ d l)))
    (* (* (/ h l) (pow (/ (* D_m M_m) d) 2.0)) -0.125))))
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 (M_m <= 5.2e-64) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else {
		tmp = sqrt(((d / h) * (d / l))) * (((h / l) * pow(((D_m * M_m) / d), 2.0)) * -0.125);
	}
	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 (m_m <= 5.2d-64) then
        tmp = sqrt((d / h)) * sqrt((d / l))
    else
        tmp = sqrt(((d / h) * (d / l))) * (((h / l) * (((d_m * m_m) / d) ** 2.0d0)) * (-0.125d0))
    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 (M_m <= 5.2e-64) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else {
		tmp = Math.sqrt(((d / h) * (d / l))) * (((h / l) * Math.pow(((D_m * M_m) / d), 2.0)) * -0.125);
	}
	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 M_m <= 5.2e-64:
		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
	else:
		tmp = math.sqrt(((d / h) * (d / l))) * (((h / l) * math.pow(((D_m * M_m) / d), 2.0)) * -0.125)
	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 (M_m <= 5.2e-64)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	else
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(Float64(Float64(h / l) * (Float64(Float64(D_m * M_m) / d) ^ 2.0)) * -0.125));
	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 (M_m <= 5.2e-64)
		tmp = sqrt((d / h)) * sqrt((d / l));
	else
		tmp = sqrt(((d / h) * (d / l))) * (((h / l) * (((D_m * M_m) / d) ^ 2.0)) * -0.125);
	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[M$95$m, 5.2e-64], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -0.125), $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}\;M\_m \leq 5.2 \cdot 10^{-64}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 5.2e-64

    1. Initial program 65.0%

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

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

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

    if 5.2e-64 < M

    1. Initial program 73.6%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \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-frac39.7%

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-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)\right)\right) \]
      10. associate-/r/57.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \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/57.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \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. unpow257.6%

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

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

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

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

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

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

        \[\leadsto {\left(\left(\color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(-0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)}^{1} \]
      4. pow1/257.7%

        \[\leadsto {\left(\left({\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}}\right) \cdot \left(-0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)}^{1} \]
      5. pow-prod-down54.6%

        \[\leadsto {\left(\color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \cdot \left(-0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)}^{1} \]
    8. Applied egg-rr54.6%

      \[\leadsto \color{blue}{{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5} \cdot \left(-0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)}^{1}} \]
    9. Step-by-step derivation
      1. unpow154.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5} \cdot \left(-0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
      2. unpow1/254.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(-0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative54.6%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(-0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. *-commutative54.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)}\right) \]
      5. associate-*r/54.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {\color{blue}{\left(\frac{D \cdot M}{d}\right)}}^{2}\right)\right) \]
    10. Simplified54.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D \cdot M}{d}\right)}^{2}\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification49.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 5.2 \cdot 10^{-64}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(\left(\frac{h}{\ell} \cdot {\left(\frac{D \cdot M}{d}\right)}^{2}\right) \cdot -0.125\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 47.0% 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.4 \cdot 10^{-199}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;d \cdot \sqrt[3]{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{1.5}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\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 (<= l -1.4e-199)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (if (<= l -2e-310)
     (* d (cbrt (pow (/ (/ 1.0 h) l) 1.5)))
     (* d (* (pow l -0.5) (pow h -0.5))))))
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.4e-199) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else if (l <= -2e-310) {
		tmp = d * cbrt(pow(((1.0 / h) / l), 1.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
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.4e-199) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else if (l <= -2e-310) {
		tmp = d * Math.cbrt(Math.pow(((1.0 / h) / l), 1.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	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.4e-199)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	elseif (l <= -2e-310)
		tmp = Float64(d * cbrt((Float64(Float64(1.0 / h) / l) ^ 1.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	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_] := If[LessEqual[l, -1.4e-199], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Power[N[Power[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.4 \cdot 10^{-199}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{1.5}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.40000000000000009e-199

    1. Initial program 63.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 6.2%

      \[\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-sqrt42.3%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. associate-*r*42.3%

        \[\leadsto \color{blue}{\left(d \cdot -1\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. *-commutative42.3%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      6. neg-mul-142.3%

        \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      7. distribute-lft-neg-in42.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      8. distribute-rgt-neg-in42.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      9. unpow-142.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      10. metadata-eval42.3%

        \[\leadsto d \cdot \left(-\sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      11. pow-sqr42.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      12. rem-sqrt-square42.3%

        \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      13. rem-square-sqrt42.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) \]
      14. fabs-sqr42.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) \]
      15. rem-square-sqrt42.3%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \]
    7. Simplified42.3%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    8. Taylor expanded in d around 0 42.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg42.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in42.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      3. *-commutative42.3%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      4. associate-/r*43.1%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    10. Simplified43.1%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if -1.40000000000000009e-199 < l < -1.999999999999994e-310

    1. Initial program 85.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified85.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{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. add-cbrt-cube53.5%

        \[\leadsto d \cdot \color{blue}{\sqrt[3]{\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}}} \]
      2. add-sqr-sqrt53.5%

        \[\leadsto d \cdot \sqrt[3]{\color{blue}{\frac{1}{h \cdot \ell}} \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      3. pow153.5%

        \[\leadsto d \cdot \sqrt[3]{\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{1}} \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      4. pow1/253.5%

        \[\leadsto d \cdot \sqrt[3]{{\left(\frac{1}{h \cdot \ell}\right)}^{1} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}} \]
      5. pow-prod-up53.5%

        \[\leadsto d \cdot \sqrt[3]{\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1 + 0.5\right)}}} \]
      6. associate-/r*53.5%

        \[\leadsto d \cdot \sqrt[3]{{\color{blue}{\left(\frac{\frac{1}{h}}{\ell}\right)}}^{\left(1 + 0.5\right)}} \]
      7. metadata-eval53.5%

        \[\leadsto d \cdot \sqrt[3]{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{\color{blue}{1.5}}} \]
    6. Applied egg-rr53.5%

      \[\leadsto d \cdot \color{blue}{\sqrt[3]{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{1.5}}} \]

    if -1.999999999999994e-310 < l

    1. Initial program 67.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 43.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity43.3%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/243.3%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow43.3%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow43.5%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval43.5%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr43.5%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity43.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified43.5%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. *-commutative43.5%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down54.1%

        \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
    10. Applied egg-rr54.1%

      \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 18: 46.4% 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.45 \cdot 10^{-184}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\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.45e-184)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (* d (* (pow l -0.5) (pow h -0.5)))))
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.45e-184) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	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.45d-184) then
        tmp = d * -sqrt(((1.0d0 / l) / h))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    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.45e-184) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	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.45e-184:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	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.45e-184)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	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.45e-184)
		tmp = d * -sqrt(((1.0 / l) / h));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	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.45e-184], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.45 \cdot 10^{-184}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 1.45000000000000007e-184

    1. Initial program 63.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified62.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 13.4%

      \[\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-sqrt38.3%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. associate-*r*38.3%

        \[\leadsto \color{blue}{\left(d \cdot -1\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. *-commutative38.3%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      6. neg-mul-138.3%

        \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      7. distribute-lft-neg-in38.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      8. distribute-rgt-neg-in38.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      9. unpow-138.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      10. metadata-eval38.3%

        \[\leadsto d \cdot \left(-\sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      11. pow-sqr38.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      12. rem-sqrt-square38.3%

        \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      13. rem-square-sqrt38.2%

        \[\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) \]
      14. fabs-sqr38.2%

        \[\leadsto d \cdot \left(-\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      15. rem-square-sqrt38.3%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \]
    7. Simplified38.3%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    8. Taylor expanded in d around 0 38.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg38.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in38.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      3. *-commutative38.3%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      4. associate-/r*38.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    10. Simplified38.9%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if 1.45000000000000007e-184 < d

    1. Initial program 72.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. Simplified72.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 47.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity47.1%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/247.1%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow47.1%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow47.3%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval47.3%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr47.3%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity47.3%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified47.3%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. *-commutative47.3%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down60.2%

        \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
    10. Applied egg-rr60.2%

      \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 43.0% 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} \mathbf{if}\;\ell \leq -2.2 \cdot 10^{-207}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\\ \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 -2.2e-207)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (* d (pow (/ (/ 1.0 h) l) 0.5))))
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 <= -2.2e-207) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else {
		tmp = d * pow(((1.0 / h) / l), 0.5);
	}
	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 <= (-2.2d-207)) then
        tmp = d * -sqrt(((1.0d0 / l) / h))
    else
        tmp = d * (((1.0d0 / h) / l) ** 0.5d0)
    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 <= -2.2e-207) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = d * Math.pow(((1.0 / h) / l), 0.5);
	}
	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 <= -2.2e-207:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	else:
		tmp = d * math.pow(((1.0 / h) / l), 0.5)
	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 <= -2.2e-207)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	else
		tmp = Float64(d * (Float64(Float64(1.0 / h) / l) ^ 0.5));
	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 <= -2.2e-207)
		tmp = d * -sqrt(((1.0 / l) / h));
	else
		tmp = d * (((1.0 / h) / l) ^ 0.5);
	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, -2.2e-207], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision], 0.5], $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.2 \cdot 10^{-207}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -2.1999999999999999e-207

    1. Initial program 63.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 6.2%

      \[\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-sqrt42.3%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. associate-*r*42.3%

        \[\leadsto \color{blue}{\left(d \cdot -1\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. *-commutative42.3%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      6. neg-mul-142.3%

        \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      7. distribute-lft-neg-in42.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      8. distribute-rgt-neg-in42.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      9. unpow-142.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      10. metadata-eval42.3%

        \[\leadsto d \cdot \left(-\sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      11. pow-sqr42.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      12. rem-sqrt-square42.3%

        \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      13. rem-square-sqrt42.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) \]
      14. fabs-sqr42.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) \]
      15. rem-square-sqrt42.3%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \]
    7. Simplified42.3%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    8. Taylor expanded in d around 0 42.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg42.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in42.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      3. *-commutative42.3%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      4. associate-/r*43.1%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    10. Simplified43.1%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if -2.1999999999999999e-207 < l

    1. Initial program 70.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 42.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. pow1/242.8%

        \[\leadsto d \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \]
      2. associate-/r*43.7%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{\frac{1}{h}}{\ell}\right)}}^{0.5} \]
    6. Applied egg-rr43.7%

      \[\leadsto d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 20: 42.8% 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} \mathbf{if}\;\ell \leq -9 \cdot 10^{-211}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \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-211) (* d (- (sqrt (/ (/ 1.0 l) h)))) (* d (pow (* l h) -0.5))))
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-211) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else {
		tmp = d * pow((l * h), -0.5);
	}
	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-211)) then
        tmp = d * -sqrt(((1.0d0 / l) / h))
    else
        tmp = d * ((l * h) ** (-0.5d0))
    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-211) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = d * Math.pow((l * h), -0.5);
	}
	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-211:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	else:
		tmp = d * math.pow((l * h), -0.5)
	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-211)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	else
		tmp = Float64(d * (Float64(l * h) ^ -0.5));
	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-211)
		tmp = d * -sqrt(((1.0 / l) / h));
	else
		tmp = d * ((l * h) ^ -0.5);
	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-211], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $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^{-211}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -8.9999999999999997e-211

    1. Initial program 63.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 6.2%

      \[\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-sqrt42.3%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. associate-*r*42.3%

        \[\leadsto \color{blue}{\left(d \cdot -1\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. *-commutative42.3%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      6. neg-mul-142.3%

        \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      7. distribute-lft-neg-in42.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      8. distribute-rgt-neg-in42.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      9. unpow-142.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      10. metadata-eval42.3%

        \[\leadsto d \cdot \left(-\sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      11. pow-sqr42.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      12. rem-sqrt-square42.3%

        \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      13. rem-square-sqrt42.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) \]
      14. fabs-sqr42.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) \]
      15. rem-square-sqrt42.3%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \]
    7. Simplified42.3%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    8. Taylor expanded in d around 0 42.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg42.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in42.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      3. *-commutative42.3%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      4. associate-/r*43.1%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    10. Simplified43.1%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if -8.9999999999999997e-211 < l

    1. Initial program 70.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 42.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity42.8%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/242.8%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow42.8%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow42.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval42.9%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr42.9%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity42.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified42.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -9 \cdot 10^{-211}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 42.8% 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 := {\left(\ell \cdot h\right)}^{-0.5}\\ \mathbf{if}\;\ell \leq -6.5 \cdot 10^{-211}:\\ \;\;\;\;\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 (pow (* l h) -0.5)))
   (if (<= l -6.5e-211) (* (- 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 = pow((l * h), -0.5);
	double tmp;
	if (l <= -6.5e-211) {
		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 = (l * h) ** (-0.5d0)
    if (l <= (-6.5d-211)) 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.pow((l * h), -0.5);
	double tmp;
	if (l <= -6.5e-211) {
		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.pow((l * h), -0.5)
	tmp = 0
	if l <= -6.5e-211:
		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 = Float64(l * h) ^ -0.5
	tmp = 0.0
	if (l <= -6.5e-211)
		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 = (l * h) ^ -0.5;
	tmp = 0.0;
	if (l <= -6.5e-211)
		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[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -6.5e-211], 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 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{-211}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -6.4999999999999996e-211

    1. Initial program 63.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 6.2%

      \[\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-sqrt42.3%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. associate-*r*42.3%

        \[\leadsto \color{blue}{\left(d \cdot -1\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. *-commutative42.3%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      6. neg-mul-142.3%

        \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      7. distribute-lft-neg-in42.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      8. distribute-rgt-neg-in42.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      9. unpow-142.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      10. metadata-eval42.3%

        \[\leadsto d \cdot \left(-\sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      11. pow-sqr42.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      12. rem-sqrt-square42.3%

        \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      13. rem-square-sqrt42.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) \]
      14. fabs-sqr42.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) \]
      15. rem-square-sqrt42.3%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \]
    7. Simplified42.3%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

    if -6.4999999999999996e-211 < l

    1. Initial program 70.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 42.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity42.8%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/242.8%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow42.8%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow42.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval42.9%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr42.9%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity42.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified42.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -6.5 \cdot 10^{-211}:\\ \;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 26.5% accurate, 3.1× 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])\\ \\ d \cdot {\left(\ell \cdot h\right)}^{-0.5} \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 (pow (* l h) -0.5)))
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 * pow((l * h), -0.5);
}
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 * ((l * h) ** (-0.5d0))
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.pow((l * h), -0.5);
}
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.pow((l * h), -0.5)
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 * (Float64(l * h) ^ -0.5))
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 * ((l * h) ^ -0.5);
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[Power[N[(l * h), $MachinePrecision], -0.5], $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])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 67.2%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified66.1%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in d around inf 26.5%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  5. Step-by-step derivation
    1. *-un-lft-identity26.5%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    2. pow1/226.5%

      \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
    3. inv-pow26.5%

      \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
    4. pow-pow26.6%

      \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
    5. metadata-eval26.6%

      \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
  6. Applied egg-rr26.6%

    \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
  7. Step-by-step derivation
    1. *-lft-identity26.6%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  8. Simplified26.6%

    \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  9. Final simplification26.6%

    \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{-0.5} \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2024145 
(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)))))