Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.2% → 83.9%
Time: 27.0s
Alternatives: 30
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 30 alternatives:

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

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

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

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


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

    1. Initial program 78.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. Simplified78.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-2neg84.1%

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

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

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

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

      \[\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 -3.80000000000000005e-149 < l < -4.999999999999985e-310

    1. Initial program 69.4%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. sqrt-div75.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) \]
      2. div-inv75.9%

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\frac{\color{blue}{\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. Simplified75.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) \]
    8. Step-by-step derivation
      1. sqrt-div80.4%

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

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

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

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

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

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

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

Alternative 2: 73.8% accurate, 0.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}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D\_m \cdot M\_m}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right) \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<=
      (*
       (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
       (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D_m M_m) (* d 2.0)) 2.0)))))
      INFINITY)
   (*
    (* (sqrt (/ d h)) (sqrt (/ d l)))
    (- 1.0 (* 0.5 (pow (* (* 0.5 (/ (* D_m M_m) d)) (sqrt (/ h l))) 2.0))))
   (*
    (* d (sqrt (/ 1.0 (* l h))))
    (-
     1.0
     (* 0.5 (pow (* (* D_m (* 0.5 (/ M_m d))) (/ (sqrt h) (sqrt l))) 2.0))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= ((double) INFINITY)) {
		tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * pow(((0.5 * ((D_m * M_m) / d)) * sqrt((h / l))), 2.0)));
	} else {
		tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * pow(((D_m * (0.5 * (M_m / d))) * (sqrt(h) / sqrt(l))), 2.0)));
	}
	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 (((Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= Double.POSITIVE_INFINITY) {
		tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * Math.pow(((0.5 * ((D_m * M_m) / d)) * Math.sqrt((h / l))), 2.0)));
	} else {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * Math.pow(((D_m * (0.5 * (M_m / d))) * (Math.sqrt(h) / Math.sqrt(l))), 2.0)));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if ((math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= math.inf:
		tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * math.pow(((0.5 * ((D_m * M_m) / d)) * math.sqrt((h / l))), 2.0)))
	else:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * math.pow(((D_m * (0.5 * (M_m / d))) * (math.sqrt(h) / math.sqrt(l))), 2.0)))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0))))) <= Inf)
		tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(0.5 * Float64(Float64(D_m * M_m) / d)) * sqrt(Float64(h / l))) ^ 2.0))));
	else
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) * Float64(sqrt(h) / sqrt(l))) ^ 2.0))));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (((((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D_m * M_m) / (d * 2.0)) ^ 2.0))))) <= Inf)
		tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (((0.5 * ((D_m * M_m) / d)) * sqrt((h / l))) ^ 2.0)));
	else
		tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * (((D_m * (0.5 * (M_m / d))) * (sqrt(h) / sqrt(l))) ^ 2.0)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D\_m \cdot M\_m}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\

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


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

    1. Initial program 88.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. Simplified86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 72.6% accurate, 0.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}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D\_m \cdot \left(0.5 \cdot M\_m\right)}{d}\right)}^{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right) \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<=
      (*
       (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
       (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D_m M_m) (* d 2.0)) 2.0)))))
      INFINITY)
   (*
    (sqrt (/ d l))
    (*
     (sqrt (/ d h))
     (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D_m (* 0.5 M_m)) d) 2.0))))))
   (*
    (* d (sqrt (/ 1.0 (* l h))))
    (-
     1.0
     (* 0.5 (pow (* (* D_m (* 0.5 (/ M_m d))) (/ (sqrt h) (sqrt l))) 2.0))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= ((double) INFINITY)) {
		tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow(((D_m * (0.5 * M_m)) / d), 2.0)))));
	} else {
		tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * pow(((D_m * (0.5 * (M_m / d))) * (sqrt(h) / sqrt(l))), 2.0)));
	}
	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 (((Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= Double.POSITIVE_INFINITY) {
		tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D_m * (0.5 * M_m)) / d), 2.0)))));
	} else {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * Math.pow(((D_m * (0.5 * (M_m / d))) * (Math.sqrt(h) / Math.sqrt(l))), 2.0)));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if ((math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= math.inf:
		tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * math.pow(((D_m * (0.5 * M_m)) / d), 2.0)))))
	else:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * math.pow(((D_m * (0.5 * (M_m / d))) * (math.sqrt(h) / math.sqrt(l))), 2.0)))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0))))) <= Inf)
		tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D_m * Float64(0.5 * M_m)) / d) ^ 2.0))))));
	else
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) * Float64(sqrt(h) / sqrt(l))) ^ 2.0))));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (((((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D_m * M_m) / (d * 2.0)) ^ 2.0))))) <= Inf)
		tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * (((D_m * (0.5 * M_m)) / d) ^ 2.0)))));
	else
		tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * (((D_m * (0.5 * (M_m / d))) * (sqrt(h) / sqrt(l))) ^ 2.0)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D\_m \cdot \left(0.5 \cdot M\_m\right)}{d}\right)}^{2}\right)\right)\right)\\

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


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

    1. Initial program 88.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. Simplified86.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. associate-/l/86.5%

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

    if -3.9999999999999999e-147 < l < -4.999999999999985e-310

    1. Initial program 69.4%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. sqrt-div75.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) \]
      2. div-inv75.9%

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\frac{\color{blue}{\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. Simplified75.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) \]
    8. Step-by-step derivation
      1. sqrt-div80.4%

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. sqrt-div75.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) \]
      2. div-inv75.9%

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\frac{\color{blue}{\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. Simplified75.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) \]
    8. Step-by-step derivation
      1. sqrt-div80.4%

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

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

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

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

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

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

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

Alternative 6: 79.4% accurate, 0.8× speedup?

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

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

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


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

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

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

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

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

    if -1.25000000000000003e-147 < l < -4.999999999999985e-310

    1. Initial program 69.4%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.4% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 76.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. Simplified75.1%

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

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

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

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

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

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

    if -8.20000000000000087e-292 < d < 4.60000000000000018e-17

    1. Initial program 53.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. Simplified51.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.60000000000000018e-17 < d

    1. Initial program 78.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified78.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 d around 0 71.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) \]
    5. Step-by-step derivation
      1. *-commutative79.2%

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

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

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

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

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

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

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

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

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


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

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

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

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

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

    if -3.9000000000000004e-152 < l < 1.9999999999999998e-308

    1. Initial program 69.4%

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

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

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

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

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

    if 1.9999999999999998e-308 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 77.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 63.7%

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

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

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

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

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

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

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

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

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

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

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

    if -9.4999999999999995e176 < h < -9.999999999999969e-311

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < h

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 75.1% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 63.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. Simplified63.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. add-sqr-sqrt63.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.60000000000000023e183 < h < -9.999999999999969e-311

    1. Initial program 80.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. Simplified77.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 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({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. 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(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      2. *-commutative0.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\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 -9.999999999999969e-311 < h

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

\mathbf{elif}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{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 h < -6.19999999999999978e181

    1. Initial program 63.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. Simplified63.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. add-sqr-sqrt63.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.19999999999999978e181 < h < -9.999999999999969e-311

    1. Initial program 80.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. Simplified77.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 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({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. 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(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      2. *-commutative0.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\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 -9.999999999999969e-311 < h

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

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

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

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

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

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

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

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

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

Alternative 12: 74.2% accurate, 1.0× speedup?

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

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


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

    1. Initial program 76.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. Simplified75.1%

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

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

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

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

    if -8.20000000000000087e-292 < d

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 76.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. Simplified75.1%

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

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

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

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

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

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

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

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

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

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

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

    if -8.20000000000000087e-292 < d

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 70.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. Simplified68.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999993e157 < l < -4.999999999999985e-310

    1. Initial program 77.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. Simplified75.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in 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({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. 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(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      2. *-commutative0.0%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l < 5.79999999999999971e126

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

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around 0 78.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) \]
    5. Step-by-step derivation
      1. *-commutative86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.79999999999999971e126 < l

    1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square36.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/236.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/36.8%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity36.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{-h}}} \cdot \frac{d}{\sqrt{\ell}} \]
      9. pow1/20.0%

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

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

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

        \[\leadsto {\color{blue}{\left(\sqrt{\left(-h\right) \cdot \left(-h\right)}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      13. sqr-neg25.3%

        \[\leadsto {\left(\sqrt{\color{blue}{h \cdot h}}\right)}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      14. sqrt-unprod59.4%

        \[\leadsto {\color{blue}{\left(\sqrt{h} \cdot \sqrt{h}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      15. add-sqr-sqrt59.7%

        \[\leadsto {\color{blue}{h}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      16. metadata-eval59.7%

        \[\leadsto {h}^{\color{blue}{-0.5}} \cdot \frac{d}{\sqrt{\ell}} \]
    13. Applied egg-rr59.7%

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

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

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

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

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

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


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

    1. Initial program 70.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. Simplified68.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      2. *-commutative59.5%

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

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

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \]
      5. clear-num65.0%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      7. sqrt-undiv61.6%

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

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

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

    if -1.15e151 < l < -4.999999999999985e-310

    1. Initial program 77.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. Simplified75.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around 0 0.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) \]
    5. Step-by-step derivation
      1. *-commutative0.0%

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

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Taylor expanded in l 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.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. *-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.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\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.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. rem-square-sqrt75.0%

        \[\leadsto \left(d \cdot \left(\color{blue}{-1} \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) \]
      4. unpow-175.0%

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

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

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

        \[\leadsto \left(d \cdot \left(-1 \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\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) \]
      8. rem-square-sqrt74.9%

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

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

        \[\leadsto \left(d \cdot \left(-1 \cdot \color{blue}{{\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) \]
    9. Simplified75.1%

      \[\leadsto \left(d \cdot \color{blue}{\left(-1 \cdot {\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) \]

    if -4.999999999999985e-310 < l < 2.5500000000000001e126

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

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around 0 78.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) \]
    5. Step-by-step derivation
      1. *-commutative86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.5500000000000001e126 < l

    1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square36.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/236.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/36.8%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity36.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{-h}}} \cdot \frac{d}{\sqrt{\ell}} \]
      9. pow1/20.0%

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

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

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

        \[\leadsto {\color{blue}{\left(\sqrt{\left(-h\right) \cdot \left(-h\right)}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      13. sqr-neg25.3%

        \[\leadsto {\left(\sqrt{\color{blue}{h \cdot h}}\right)}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      14. sqrt-unprod59.4%

        \[\leadsto {\color{blue}{\left(\sqrt{h} \cdot \sqrt{h}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      15. add-sqr-sqrt59.7%

        \[\leadsto {\color{blue}{h}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      16. metadata-eval59.7%

        \[\leadsto {h}^{\color{blue}{-0.5}} \cdot \frac{d}{\sqrt{\ell}} \]
    13. Applied egg-rr59.7%

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

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

Alternative 16: 57.1% accurate, 1.4× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    7. Step-by-step derivation
      1. *-rgt-identity45.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      7. sqrt-undiv46.9%

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

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

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

    if -1.00000000000000005e-181 < l < 8.3999999999999999e-305

    1. Initial program 74.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. Simplified71.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt31.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| \]
      6. fabs-sqr31.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt[3]{{\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1.5}}} \]
    10. Applied egg-rr37.4%

      \[\leadsto d \cdot \color{blue}{\sqrt[3]{{\left(\frac{1}{h \cdot \ell}\right)}^{1.5}}} \]
    11. Step-by-step derivation
      1. associate-/r*37.4%

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

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

    if 8.3999999999999999e-305 < l < 1.52000000000000007e119

    1. Initial program 73.2%

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

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

      \[\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) \]
    5. Step-by-step derivation
      1. *-commutative86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.52000000000000007e119 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt39.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| \]
      6. fabs-sqr39.2%

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/239.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/39.2%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity39.2%

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{h \cdot h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      6. sqr-neg26.0%

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{-h}}} \cdot \frac{d}{\sqrt{\ell}} \]
      9. pow1/20.0%

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

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

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

        \[\leadsto {\color{blue}{\left(\sqrt{\left(-h\right) \cdot \left(-h\right)}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      13. sqr-neg26.1%

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

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

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

        \[\leadsto {h}^{\color{blue}{-0.5}} \cdot \frac{d}{\sqrt{\ell}} \]
    13. Applied egg-rr60.3%

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

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

Alternative 17: 48.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}\;d \leq -1.38 \cdot 10^{-142}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{elif}\;d \leq 1.4 \cdot 10^{-23}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \left(h \cdot \frac{0.5}{\ell}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-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.38e-142)
   (/ (sqrt (/ d l)) (sqrt (/ h d)))
   (if (<= d -4e-310)
     (/ d (cbrt (pow (* l h) 1.5)))
     (if (<= d 1.4e-23)
       (*
        (* d (sqrt (/ 1.0 (* l h))))
        (* -0.25 (* (pow (/ (* D_m M_m) d) 2.0) (* h (/ 0.5 l)))))
       (* d (* (pow h -0.5) (pow 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 (d <= -1.38e-142) {
		tmp = sqrt((d / l)) / sqrt((h / d));
	} else if (d <= -4e-310) {
		tmp = d / cbrt(pow((l * h), 1.5));
	} else if (d <= 1.4e-23) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (-0.25 * (pow(((D_m * M_m) / d), 2.0) * (h * (0.5 / l))));
	} else {
		tmp = d * (pow(h, -0.5) * pow(l, -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 (d <= -1.38e-142) {
		tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
	} else if (d <= -4e-310) {
		tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
	} else if (d <= 1.4e-23) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-0.25 * (Math.pow(((D_m * M_m) / d), 2.0) * (h * (0.5 / l))));
	} else {
		tmp = d * (Math.pow(h, -0.5) * Math.pow(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 (d <= -1.38e-142)
		tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d)));
	elseif (d <= -4e-310)
		tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5)));
	elseif (d <= 1.4e-23)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-0.25 * Float64((Float64(Float64(D_m * M_m) / d) ^ 2.0) * Float64(h * Float64(0.5 / l)))));
	else
		tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -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[d, -1.38e-142], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-23], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.25 * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -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.38 \cdot 10^{-142}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr80.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in D around 0 49.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    7. Step-by-step derivation
      1. *-rgt-identity49.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      2. *-commutative49.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}} \]
      3. frac-2neg49.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \sqrt{\color{blue}{\frac{-d}{-h}}} \]
      4. sqrt-undiv53.6%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \]
      5. clear-num53.5%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{1}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      6. un-div-inv53.5%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      7. sqrt-undiv50.4%

        \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\color{blue}{\sqrt{\frac{-h}{-d}}}} \]
      8. frac-2neg50.4%

        \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\color{blue}{\frac{h}{d}}}} \]
    8. Applied egg-rr50.4%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}} \]

    if -1.37999999999999998e-142 < d < -3.999999999999988e-310

    1. Initial program 63.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. Simplified60.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. add-sqr-sqrt60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow260.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow160.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow160.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr60.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 24.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-124.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval24.9%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr24.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square24.9%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt24.9%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr24.9%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt24.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified24.9%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 24.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative24.9%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/224.9%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log24.9%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp24.9%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod24.9%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out24.9%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg24.9%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow24.9%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/224.9%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/24.9%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity24.9%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified24.9%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Step-by-step derivation
      1. add-cbrt-cube30.5%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{\left(\sqrt{h \cdot \ell} \cdot \sqrt{h \cdot \ell}\right) \cdot \sqrt{h \cdot \ell}}}} \]
      2. pow1/330.5%

        \[\leadsto \frac{d}{\color{blue}{{\left(\left(\sqrt{h \cdot \ell} \cdot \sqrt{h \cdot \ell}\right) \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}}} \]
      3. add-sqr-sqrt30.5%

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(h \cdot \ell\right)} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      4. pow130.5%

        \[\leadsto \frac{d}{{\left(\color{blue}{{\left(h \cdot \ell\right)}^{1}} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      5. pow1/230.5%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{1} \cdot \color{blue}{{\left(h \cdot \ell\right)}^{0.5}}\right)}^{0.3333333333333333}} \]
      6. pow-prod-up30.5%

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(h \cdot \ell\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. metadata-eval30.5%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    13. Applied egg-rr30.5%

      \[\leadsto \frac{d}{\color{blue}{{\left({\left(h \cdot \ell\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    14. Step-by-step derivation
      1. unpow1/330.5%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]
    15. Simplified30.5%

      \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]

    if -3.999999999999988e-310 < d < 1.3999999999999999e-23

    1. Initial program 54.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. Simplified52.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 d around 0 61.7%

      \[\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) \]
    5. Step-by-step derivation
      1. *-commutative66.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right) \]
    6. Simplified61.7%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Step-by-step derivation
      1. add-sqr-sqrt61.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)} \cdot \sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}}\right) \]
      2. pow261.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)}^{2}}\right) \]
      3. *-commutative61.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.5}}\right)}^{2}\right) \]
      4. sqrt-prod61.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{0.5}\right)}}^{2}\right) \]
      5. *-commutative61.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}} \cdot \sqrt{0.5}\right)}^{2}\right) \]
      6. sqrt-prod61.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\color{blue}{\left(\sqrt{\frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}\right)} \cdot \sqrt{0.5}\right)}^{2}\right) \]
      7. sqrt-pow166.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      8. metadata-eval66.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\color{blue}{1}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      9. pow166.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      10. associate-*r/68.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{\frac{\frac{M}{2} \cdot D}{d}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      11. div-inv68.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      12. metadata-eval68.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\left(M \cdot \color{blue}{0.5}\right) \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
    8. Applied egg-rr68.4%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{{\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\left(M \cdot 0.5\right) \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}}\right) \]
    9. Taylor expanded in h around inf 39.6%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \color{blue}{\left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot {\left(\sqrt{0.5}\right)}^{2}\right)\right)}{{d}^{2} \cdot \ell}\right)} \]
    10. Step-by-step derivation
      1. *-commutative39.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot {\left(\sqrt{0.5}\right)}^{2}\right)\right)}{{d}^{2} \cdot \ell} \cdot -0.25\right)} \]
      2. associate-*r*38.0%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot \left(h \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}}{{d}^{2} \cdot \ell} \cdot -0.25\right) \]
      3. times-frac37.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{h \cdot {\left(\sqrt{0.5}\right)}^{2}}{\ell}\right)} \cdot -0.25\right) \]
      4. associate-/l*36.2%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left(\color{blue}{\left({D}^{2} \cdot \frac{{M}^{2}}{{d}^{2}}\right)} \cdot \frac{h \cdot {\left(\sqrt{0.5}\right)}^{2}}{\ell}\right) \cdot -0.25\right) \]
      5. unpow236.2%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left(\left(\color{blue}{\left(D \cdot D\right)} \cdot \frac{{M}^{2}}{{d}^{2}}\right) \cdot \frac{h \cdot {\left(\sqrt{0.5}\right)}^{2}}{\ell}\right) \cdot -0.25\right) \]
      6. unpow236.2%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left(\left(\left(D \cdot D\right) \cdot \frac{\color{blue}{M \cdot M}}{{d}^{2}}\right) \cdot \frac{h \cdot {\left(\sqrt{0.5}\right)}^{2}}{\ell}\right) \cdot -0.25\right) \]
      7. unpow236.2%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left(\left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{\color{blue}{d \cdot d}}\right) \cdot \frac{h \cdot {\left(\sqrt{0.5}\right)}^{2}}{\ell}\right) \cdot -0.25\right) \]
      8. times-frac45.0%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left(\left(\left(D \cdot D\right) \cdot \color{blue}{\left(\frac{M}{d} \cdot \frac{M}{d}\right)}\right) \cdot \frac{h \cdot {\left(\sqrt{0.5}\right)}^{2}}{\ell}\right) \cdot -0.25\right) \]
      9. swap-sqr51.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left(\color{blue}{\left(\left(D \cdot \frac{M}{d}\right) \cdot \left(D \cdot \frac{M}{d}\right)\right)} \cdot \frac{h \cdot {\left(\sqrt{0.5}\right)}^{2}}{\ell}\right) \cdot -0.25\right) \]
      10. unpow251.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left(\color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2}} \cdot \frac{h \cdot {\left(\sqrt{0.5}\right)}^{2}}{\ell}\right) \cdot -0.25\right) \]
      11. associate-*r/53.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left({\color{blue}{\left(\frac{D \cdot M}{d}\right)}}^{2} \cdot \frac{h \cdot {\left(\sqrt{0.5}\right)}^{2}}{\ell}\right) \cdot -0.25\right) \]
      12. unpow253.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \frac{h \cdot \color{blue}{\left(\sqrt{0.5} \cdot \sqrt{0.5}\right)}}{\ell}\right) \cdot -0.25\right) \]
      13. rem-square-sqrt53.5%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \frac{h \cdot \color{blue}{0.5}}{\ell}\right) \cdot -0.25\right) \]
      14. associate-/l*53.5%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \color{blue}{\left(h \cdot \frac{0.5}{\ell}\right)}\right) \cdot -0.25\right) \]
    11. Simplified53.5%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \color{blue}{\left(\left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \left(h \cdot \frac{0.5}{\ell}\right)\right) \cdot -0.25\right)} \]

    if 1.3999999999999999e-23 < d

    1. Initial program 77.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. Simplified77.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. add-sqr-sqrt77.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow277.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod77.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow179.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow179.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr78.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 53.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-153.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval53.2%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr53.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square53.2%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt53.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| \]
      6. fabs-sqr53.1%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt53.2%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified53.2%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. *-commutative53.2%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down70.0%

        \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
    10. Applied egg-rr70.0%

      \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification52.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.38 \cdot 10^{-142}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{elif}\;d \leq 1.4 \cdot 10^{-23}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-0.25 \cdot \left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \left(h \cdot \frac{0.5}{\ell}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 73.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 -5 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 4.1 \cdot 10^{+125}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -5e-310)
   (*
    (* d (sqrt (/ (/ 1.0 l) h)))
    (+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))) -1.0))
   (if (<= l 4.1e+125)
     (*
      (* d (sqrt (/ 1.0 (* l h))))
      (+ 1.0 (* h (* -0.25 (* (pow (/ (* D_m M_m) d) 2.0) (/ 0.5 l))))))
     (* (pow h -0.5) (/ d (sqrt l))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -5e-310) {
		tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
	} else if (l <= 4.1e+125) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
	} else {
		tmp = pow(h, -0.5) * (d / sqrt(l));
	}
	return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (l <= (-5d-310)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))) + (-1.0d0))
    else if (l <= 4.1d+125) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 + (h * ((-0.25d0) * ((((d_m * m_m) / d) ** 2.0d0) * (0.5d0 / l)))))
    else
        tmp = (h ** (-0.5d0)) * (d / sqrt(l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -5e-310) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
	} else if (l <= 4.1e+125) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (Math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
	} else {
		tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if l <= -5e-310:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0)
	elif l <= 4.1e+125:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))))
	else:
		tmp = math.pow(h, -0.5) * (d / math.sqrt(l))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -5e-310)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) + -1.0));
	elseif (l <= 4.1e+125)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 + Float64(h * Float64(-0.25 * Float64((Float64(Float64(D_m * M_m) / d) ^ 2.0) * Float64(0.5 / l))))));
	else
		tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l)));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (l <= -5e-310)
		tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))) + -1.0);
	elseif (l <= 4.1e+125)
		tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * ((((D_m * M_m) / d) ^ 2.0) * (0.5 / l)))));
	else
		tmp = (h ^ -0.5) * (d / sqrt(l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(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] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.1e+125], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.25 * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right) + -1\right)\\

\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{+125}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -4.999999999999985e-310

    1. Initial program 76.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. Simplified74.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in 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({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. 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(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      2. *-commutative0.0%

        \[\leadsto \left(\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      3. associate-/r*0.0%

        \[\leadsto \left(\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      4. *-commutative0.0%

        \[\leadsto \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. unpow20.0%

        \[\leadsto \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right)\right) \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. rem-square-sqrt71.6%

        \[\leadsto \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{-1} \cdot d\right)\right) \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. neg-mul-171.6%

        \[\leadsto \left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left(-d\right)}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D \cdot M}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    6. Simplified70.1%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]

    if -4.999999999999985e-310 < l < 4.09999999999999992e125

    1. Initial program 71.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. Simplified70.1%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around 0 78.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) \]
    5. Step-by-step derivation
      1. *-commutative86.0%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right) \]
    6. Simplified78.4%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Step-by-step derivation
      1. add-sqr-sqrt78.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)} \cdot \sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}}\right) \]
      2. pow278.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)}^{2}}\right) \]
      3. *-commutative78.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.5}}\right)}^{2}\right) \]
      4. sqrt-prod78.3%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{0.5}\right)}}^{2}\right) \]
      5. *-commutative78.3%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}} \cdot \sqrt{0.5}\right)}^{2}\right) \]
      6. sqrt-prod78.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\color{blue}{\left(\sqrt{\frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}\right)} \cdot \sqrt{0.5}\right)}^{2}\right) \]
      7. sqrt-pow180.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      8. metadata-eval80.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\color{blue}{1}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      9. pow180.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      10. associate-*r/80.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{\frac{\frac{M}{2} \cdot D}{d}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      11. div-inv80.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      12. metadata-eval80.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\left(M \cdot \color{blue}{0.5}\right) \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
    8. Applied egg-rr80.8%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{{\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\left(M \cdot 0.5\right) \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}}\right) \]
    9. Taylor expanded in h around inf 63.6%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \color{blue}{\left(h \cdot \left(\frac{1}{h} - 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right)} \]
    10. Step-by-step derivation
      1. sub-neg63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(h \cdot \color{blue}{\left(\frac{1}{h} + \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right)}\right) \]
      2. distribute-lft-in63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \color{blue}{\left(h \cdot \frac{1}{h} + h \cdot \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right)} \]
      3. rgt-mult-inverse63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\color{blue}{1} + h \cdot \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right) \]
      4. distribute-lft-neg-in63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \color{blue}{\left(\left(-0.25\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
      5. metadata-eval63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(\color{blue}{-0.25} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right) \]
      6. associate-*r*63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot {\left(\sqrt{0.5}\right)}^{2}}}{{d}^{2} \cdot \ell}\right)\right) \]
      7. unpow263.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot \color{blue}{\left(\sqrt{0.5} \cdot \sqrt{0.5}\right)}}{{d}^{2} \cdot \ell}\right)\right) \]
      8. rem-square-sqrt63.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot \color{blue}{0.5}}{{d}^{2} \cdot \ell}\right)\right) \]
      9. times-frac62.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{0.5}{\ell}\right)}\right)\right) \]
    11. Simplified83.3%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \color{blue}{\left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)} \]

    if 4.09999999999999992e125 < l

    1. Initial program 52.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified52.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt52.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow252.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod52.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow155.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative55.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval55.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow155.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv55.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr49.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 36.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-136.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval36.9%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr36.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square36.9%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt36.8%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr36.8%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt36.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified36.9%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 36.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative36.9%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/236.9%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log35.4%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp35.4%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod35.4%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out35.4%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg35.4%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow36.8%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/236.8%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/36.8%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity36.8%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified36.8%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Step-by-step derivation
      1. *-un-lft-identity36.8%

        \[\leadsto \frac{\color{blue}{1 \cdot d}}{\sqrt{h \cdot \ell}} \]
      2. sqrt-prod59.3%

        \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      3. times-frac59.3%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}} \]
      4. add-sqr-sqrt59.3%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{h} \cdot \sqrt{h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      5. sqrt-unprod25.2%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{h \cdot h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      6. sqr-neg25.2%

        \[\leadsto \frac{1}{\sqrt{\sqrt{\color{blue}{\left(-h\right) \cdot \left(-h\right)}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      7. sqrt-unprod0.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{-h} \cdot \sqrt{-h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      8. add-sqr-sqrt0.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{-h}}} \cdot \frac{d}{\sqrt{\ell}} \]
      9. pow1/20.0%

        \[\leadsto \frac{1}{\color{blue}{{\left(-h\right)}^{0.5}}} \cdot \frac{d}{\sqrt{\ell}} \]
      10. pow-flip0.0%

        \[\leadsto \color{blue}{{\left(-h\right)}^{\left(-0.5\right)}} \cdot \frac{d}{\sqrt{\ell}} \]
      11. add-sqr-sqrt0.0%

        \[\leadsto {\color{blue}{\left(\sqrt{-h} \cdot \sqrt{-h}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      12. sqrt-unprod25.3%

        \[\leadsto {\color{blue}{\left(\sqrt{\left(-h\right) \cdot \left(-h\right)}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      13. sqr-neg25.3%

        \[\leadsto {\left(\sqrt{\color{blue}{h \cdot h}}\right)}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      14. sqrt-unprod59.4%

        \[\leadsto {\color{blue}{\left(\sqrt{h} \cdot \sqrt{h}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      15. add-sqr-sqrt59.7%

        \[\leadsto {\color{blue}{h}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      16. metadata-eval59.7%

        \[\leadsto {h}^{\color{blue}{-0.5}} \cdot \frac{d}{\sqrt{\ell}} \]
    13. Applied egg-rr59.7%

      \[\leadsto \color{blue}{{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification72.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 4.1 \cdot 10^{+125}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 66.2% 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 -5 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+126}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -5e-310)
   (*
    (sqrt (* (/ d h) (/ d l)))
    (+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ M_m d) (* D_m 0.5)) 2.0)))))
   (if (<= l 5.5e+126)
     (*
      (* d (sqrt (/ 1.0 (* l h))))
      (+ 1.0 (* h (* -0.25 (* (pow (/ (* D_m M_m) d) 2.0) (/ 0.5 l))))))
     (* (pow h -0.5) (/ d (sqrt l))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -5e-310) {
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m / d) * (D_m * 0.5)), 2.0))));
	} else if (l <= 5.5e+126) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
	} else {
		tmp = pow(h, -0.5) * (d / sqrt(l));
	}
	return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (l <= (-5d-310)) then
        tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m / d) * (d_m * 0.5d0)) ** 2.0d0))))
    else if (l <= 5.5d+126) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 + (h * ((-0.25d0) * ((((d_m * m_m) / d) ** 2.0d0) * (0.5d0 / l)))))
    else
        tmp = (h ** (-0.5d0)) * (d / sqrt(l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -5e-310) {
		tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m / d) * (D_m * 0.5)), 2.0))));
	} else if (l <= 5.5e+126) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (Math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
	} else {
		tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if l <= -5e-310:
		tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m / d) * (D_m * 0.5)), 2.0))))
	elif l <= 5.5e+126:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))))
	else:
		tmp = math.pow(h, -0.5) * (d / math.sqrt(l))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -5e-310)
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / d) * Float64(D_m * 0.5)) ^ 2.0)))));
	elseif (l <= 5.5e+126)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 + Float64(h * Float64(-0.25 * Float64((Float64(Float64(D_m * M_m) / d) ^ 2.0) * Float64(0.5 / l))))));
	else
		tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l)));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (l <= -5e-310)
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * (((M_m / d) * (D_m * 0.5)) ^ 2.0))));
	elseif (l <= 5.5e+126)
		tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * ((((D_m * M_m) / d) ^ 2.0) * (0.5 / l)))));
	else
		tmp = (h ^ -0.5) * (d / sqrt(l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.5e+126], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.25 * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\

\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+126}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -4.999999999999985e-310

    1. Initial program 76.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. Simplified74.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. add-sqr-sqrt73.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow273.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod74.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow174.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative74.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval74.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow174.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv74.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*75.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac75.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative75.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac75.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval75.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr75.3%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Step-by-step derivation
      1. pow175.3%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)}^{1}} \]
      2. sqrt-unprod63.3%

        \[\leadsto {\left(\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)}^{1} \]
      3. cancel-sign-sub-inv63.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(1 + \left(-0.5\right) \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)}\right)}^{1} \]
      4. metadata-eval63.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \color{blue}{-0.5} \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)}^{1} \]
      5. *-commutative63.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot {\color{blue}{\left(\sqrt{\frac{h}{\ell}} \cdot \left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)\right)}}^{2}\right)\right)}^{1} \]
      6. unpow-prod-down62.6%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left({\left(\sqrt{\frac{h}{\ell}}\right)}^{2} \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)}\right)\right)}^{1} \]
      7. pow262.6%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\color{blue}{\left(\sqrt{\frac{h}{\ell}} \cdot \sqrt{\frac{h}{\ell}}\right)} \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)\right)}^{1} \]
      8. add-sqr-sqrt62.7%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\color{blue}{\frac{h}{\ell}} \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)\right)}^{1} \]
      9. associate-*r*62.7%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\color{blue}{\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}}^{2}\right)\right)\right)}^{1} \]
    7. Applied egg-rr62.7%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right)\right)\right)}^{1}} \]
    8. Step-by-step derivation
      1. unpow162.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right)\right)} \]
      2. *-lft-identity62.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(1 \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right)\right)\right)} \]
      3. *-lft-identity62.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right)\right)} \]
      4. *-commutative62.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \color{blue}{\left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right) \cdot -0.5}\right) \]
    9. Simplified62.7%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right) \cdot -0.5\right)} \]

    if -4.999999999999985e-310 < l < 5.5000000000000004e126

    1. Initial program 71.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. Simplified70.1%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around 0 78.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) \]
    5. Step-by-step derivation
      1. *-commutative86.0%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right) \]
    6. Simplified78.4%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Step-by-step derivation
      1. add-sqr-sqrt78.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)} \cdot \sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}}\right) \]
      2. pow278.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)}^{2}}\right) \]
      3. *-commutative78.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.5}}\right)}^{2}\right) \]
      4. sqrt-prod78.3%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{0.5}\right)}}^{2}\right) \]
      5. *-commutative78.3%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}} \cdot \sqrt{0.5}\right)}^{2}\right) \]
      6. sqrt-prod78.4%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\color{blue}{\left(\sqrt{\frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}\right)} \cdot \sqrt{0.5}\right)}^{2}\right) \]
      7. sqrt-pow180.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      8. metadata-eval80.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\color{blue}{1}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      9. pow180.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      10. associate-*r/80.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{\frac{\frac{M}{2} \cdot D}{d}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      11. div-inv80.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      12. metadata-eval80.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\left(M \cdot \color{blue}{0.5}\right) \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
    8. Applied egg-rr80.8%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{{\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\left(M \cdot 0.5\right) \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}}\right) \]
    9. Taylor expanded in h around inf 63.6%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \color{blue}{\left(h \cdot \left(\frac{1}{h} - 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right)} \]
    10. Step-by-step derivation
      1. sub-neg63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(h \cdot \color{blue}{\left(\frac{1}{h} + \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right)}\right) \]
      2. distribute-lft-in63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \color{blue}{\left(h \cdot \frac{1}{h} + h \cdot \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right)} \]
      3. rgt-mult-inverse63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\color{blue}{1} + h \cdot \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right) \]
      4. distribute-lft-neg-in63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \color{blue}{\left(\left(-0.25\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
      5. metadata-eval63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(\color{blue}{-0.25} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{0.5}\right)}^{2}\right)}{{d}^{2} \cdot \ell}\right)\right) \]
      6. associate-*r*63.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot {\left(\sqrt{0.5}\right)}^{2}}}{{d}^{2} \cdot \ell}\right)\right) \]
      7. unpow263.6%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot \color{blue}{\left(\sqrt{0.5} \cdot \sqrt{0.5}\right)}}{{d}^{2} \cdot \ell}\right)\right) \]
      8. rem-square-sqrt63.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot \color{blue}{0.5}}{{d}^{2} \cdot \ell}\right)\right) \]
      9. times-frac62.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \frac{0.5}{\ell}\right)}\right)\right) \]
    11. Simplified83.3%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \color{blue}{\left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)} \]

    if 5.5000000000000004e126 < l

    1. Initial program 52.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified52.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt52.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow252.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod52.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow155.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative55.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval55.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow155.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv55.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval49.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr49.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 36.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-136.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval36.9%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr36.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square36.9%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt36.8%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr36.8%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt36.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified36.9%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 36.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative36.9%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/236.9%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log35.4%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp35.4%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod35.4%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out35.4%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg35.4%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow36.8%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/236.8%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/36.8%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity36.8%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified36.8%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Step-by-step derivation
      1. *-un-lft-identity36.8%

        \[\leadsto \frac{\color{blue}{1 \cdot d}}{\sqrt{h \cdot \ell}} \]
      2. sqrt-prod59.3%

        \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      3. times-frac59.3%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}} \]
      4. add-sqr-sqrt59.3%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{h} \cdot \sqrt{h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      5. sqrt-unprod25.2%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{h \cdot h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      6. sqr-neg25.2%

        \[\leadsto \frac{1}{\sqrt{\sqrt{\color{blue}{\left(-h\right) \cdot \left(-h\right)}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      7. sqrt-unprod0.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{-h} \cdot \sqrt{-h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      8. add-sqr-sqrt0.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{-h}}} \cdot \frac{d}{\sqrt{\ell}} \]
      9. pow1/20.0%

        \[\leadsto \frac{1}{\color{blue}{{\left(-h\right)}^{0.5}}} \cdot \frac{d}{\sqrt{\ell}} \]
      10. pow-flip0.0%

        \[\leadsto \color{blue}{{\left(-h\right)}^{\left(-0.5\right)}} \cdot \frac{d}{\sqrt{\ell}} \]
      11. add-sqr-sqrt0.0%

        \[\leadsto {\color{blue}{\left(\sqrt{-h} \cdot \sqrt{-h}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      12. sqrt-unprod25.3%

        \[\leadsto {\color{blue}{\left(\sqrt{\left(-h\right) \cdot \left(-h\right)}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      13. sqr-neg25.3%

        \[\leadsto {\left(\sqrt{\color{blue}{h \cdot h}}\right)}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      14. sqrt-unprod59.4%

        \[\leadsto {\color{blue}{\left(\sqrt{h} \cdot \sqrt{h}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      15. add-sqr-sqrt59.7%

        \[\leadsto {\color{blue}{h}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      16. metadata-eval59.7%

        \[\leadsto {h}^{\color{blue}{-0.5}} \cdot \frac{d}{\sqrt{\ell}} \]
    13. Applied egg-rr59.7%

      \[\leadsto \color{blue}{{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification68.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+126}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 64.6% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+116}:\\ \;\;\;\;\frac{d \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right)}^{2}\right)\right)}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -5e-310)
   (*
    (sqrt (* (/ d h) (/ d l)))
    (+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ M_m d) (* D_m 0.5)) 2.0)))))
   (if (<= l 1.5e+116)
     (/
      (* d (+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D_m d) (* 0.5 M_m)) 2.0)))))
      (sqrt (* l h)))
     (* (pow h -0.5) (/ d (sqrt l))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -5e-310) {
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m / d) * (D_m * 0.5)), 2.0))));
	} else if (l <= 1.5e+116) {
		tmp = (d * (1.0 + (-0.5 * ((h / l) * pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / sqrt((l * h));
	} else {
		tmp = pow(h, -0.5) * (d / sqrt(l));
	}
	return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (l <= (-5d-310)) then
        tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m / d) * (d_m * 0.5d0)) ** 2.0d0))))
    else if (l <= 1.5d+116) then
        tmp = (d * (1.0d0 + ((-0.5d0) * ((h / l) * (((d_m / d) * (0.5d0 * m_m)) ** 2.0d0))))) / sqrt((l * h))
    else
        tmp = (h ** (-0.5d0)) * (d / sqrt(l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -5e-310) {
		tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m / d) * (D_m * 0.5)), 2.0))));
	} else if (l <= 1.5e+116) {
		tmp = (d * (1.0 + (-0.5 * ((h / l) * Math.pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / Math.sqrt((l * h));
	} else {
		tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if l <= -5e-310:
		tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m / d) * (D_m * 0.5)), 2.0))))
	elif l <= 1.5e+116:
		tmp = (d * (1.0 + (-0.5 * ((h / l) * math.pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / math.sqrt((l * h))
	else:
		tmp = math.pow(h, -0.5) * (d / math.sqrt(l))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -5e-310)
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / d) * Float64(D_m * 0.5)) ^ 2.0)))));
	elseif (l <= 1.5e+116)
		tmp = Float64(Float64(d * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0))))) / sqrt(Float64(l * h)));
	else
		tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l)));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (l <= -5e-310)
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * (((M_m / d) * (D_m * 0.5)) ^ 2.0))));
	elseif (l <= 1.5e+116)
		tmp = (d * (1.0 + (-0.5 * ((h / l) * (((D_m / d) * (0.5 * M_m)) ^ 2.0))))) / sqrt((l * h));
	else
		tmp = (h ^ -0.5) * (d / sqrt(l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e+116], N[(N[(d * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\

\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+116}:\\
\;\;\;\;\frac{d \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right)}^{2}\right)\right)}{\sqrt{\ell \cdot h}}\\

\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -4.999999999999985e-310

    1. Initial program 76.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. Simplified74.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. add-sqr-sqrt73.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow273.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod74.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow174.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative74.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval74.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow174.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv74.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*75.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac75.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative75.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac75.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval75.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr75.3%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Step-by-step derivation
      1. pow175.3%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)}^{1}} \]
      2. sqrt-unprod63.3%

        \[\leadsto {\left(\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)}^{1} \]
      3. cancel-sign-sub-inv63.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(1 + \left(-0.5\right) \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)}\right)}^{1} \]
      4. metadata-eval63.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \color{blue}{-0.5} \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)}^{1} \]
      5. *-commutative63.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot {\color{blue}{\left(\sqrt{\frac{h}{\ell}} \cdot \left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)\right)}}^{2}\right)\right)}^{1} \]
      6. unpow-prod-down62.6%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left({\left(\sqrt{\frac{h}{\ell}}\right)}^{2} \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)}\right)\right)}^{1} \]
      7. pow262.6%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\color{blue}{\left(\sqrt{\frac{h}{\ell}} \cdot \sqrt{\frac{h}{\ell}}\right)} \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)\right)}^{1} \]
      8. add-sqr-sqrt62.7%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\color{blue}{\frac{h}{\ell}} \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)\right)}^{1} \]
      9. associate-*r*62.7%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\color{blue}{\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}}^{2}\right)\right)\right)}^{1} \]
    7. Applied egg-rr62.7%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right)\right)\right)}^{1}} \]
    8. Step-by-step derivation
      1. unpow162.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right)\right)} \]
      2. *-lft-identity62.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(1 \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right)\right)\right)} \]
      3. *-lft-identity62.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right)\right)} \]
      4. *-commutative62.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \color{blue}{\left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right) \cdot -0.5}\right) \]
    9. Simplified62.7%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot {\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2}\right) \cdot -0.5\right)} \]

    if -4.999999999999985e-310 < l < 1.4999999999999999e116

    1. Initial program 71.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.1%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around 0 78.8%

      \[\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) \]
    5. Step-by-step derivation
      1. *-commutative86.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right) \]
    6. Simplified78.8%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Step-by-step derivation
      1. add-sqr-sqrt78.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{\sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)} \cdot \sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}}\right) \]
      2. pow278.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)}^{2}}\right) \]
      3. *-commutative78.8%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot 0.5}}\right)}^{2}\right) \]
      4. sqrt-prod78.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{0.5}\right)}}^{2}\right) \]
      5. *-commutative78.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}} \cdot \sqrt{0.5}\right)}^{2}\right) \]
      6. sqrt-prod78.7%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\color{blue}{\left(\sqrt{\frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}\right)} \cdot \sqrt{0.5}\right)}^{2}\right) \]
      7. sqrt-pow181.3%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      8. metadata-eval81.3%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\color{blue}{1}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      9. pow181.3%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      10. associate-*r/81.2%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \color{blue}{\frac{\frac{M}{2} \cdot D}{d}}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      11. div-inv81.2%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
      12. metadata-eval81.2%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - {\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\left(M \cdot \color{blue}{0.5}\right) \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}\right) \]
    8. Applied egg-rr81.2%

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \color{blue}{{\left(\left(\sqrt{\frac{h}{\ell}} \cdot \frac{\left(M \cdot 0.5\right) \cdot D}{d}\right) \cdot \sqrt{0.5}\right)}^{2}}\right) \]
    9. Applied egg-rr80.1%

      \[\leadsto \color{blue}{\frac{d \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)}{\sqrt{h \cdot \ell}}} \]

    if 1.4999999999999999e116 < l

    1. Initial program 53.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. Simplified53.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt53.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow253.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod53.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow156.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative56.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval56.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow156.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv56.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*51.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac51.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative51.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac51.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval51.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr51.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 39.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-139.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval39.4%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr39.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square39.4%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt39.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| \]
      6. fabs-sqr39.2%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt39.4%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified39.4%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 39.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative39.4%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/239.4%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log37.5%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp37.5%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod37.5%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out37.5%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg37.5%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow39.2%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/239.2%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/39.2%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity39.2%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified39.2%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Step-by-step derivation
      1. *-un-lft-identity39.2%

        \[\leadsto \frac{\color{blue}{1 \cdot d}}{\sqrt{h \cdot \ell}} \]
      2. sqrt-prod59.9%

        \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      3. times-frac60.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}} \]
      4. add-sqr-sqrt60.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{h} \cdot \sqrt{h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      5. sqrt-unprod26.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{h \cdot h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      6. sqr-neg26.0%

        \[\leadsto \frac{1}{\sqrt{\sqrt{\color{blue}{\left(-h\right) \cdot \left(-h\right)}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      7. sqrt-unprod0.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\sqrt{-h} \cdot \sqrt{-h}}}} \cdot \frac{d}{\sqrt{\ell}} \]
      8. add-sqr-sqrt0.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{-h}}} \cdot \frac{d}{\sqrt{\ell}} \]
      9. pow1/20.0%

        \[\leadsto \frac{1}{\color{blue}{{\left(-h\right)}^{0.5}}} \cdot \frac{d}{\sqrt{\ell}} \]
      10. pow-flip0.0%

        \[\leadsto \color{blue}{{\left(-h\right)}^{\left(-0.5\right)}} \cdot \frac{d}{\sqrt{\ell}} \]
      11. add-sqr-sqrt0.0%

        \[\leadsto {\color{blue}{\left(\sqrt{-h} \cdot \sqrt{-h}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      12. sqrt-unprod26.1%

        \[\leadsto {\color{blue}{\left(\sqrt{\left(-h\right) \cdot \left(-h\right)}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      13. sqr-neg26.1%

        \[\leadsto {\left(\sqrt{\color{blue}{h \cdot h}}\right)}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      14. sqrt-unprod60.1%

        \[\leadsto {\color{blue}{\left(\sqrt{h} \cdot \sqrt{h}\right)}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      15. add-sqr-sqrt60.3%

        \[\leadsto {\color{blue}{h}}^{\left(-0.5\right)} \cdot \frac{d}{\sqrt{\ell}} \]
      16. metadata-eval60.3%

        \[\leadsto {h}^{\color{blue}{-0.5}} \cdot \frac{d}{\sqrt{\ell}} \]
    13. Applied egg-rr60.3%

      \[\leadsto \color{blue}{{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+116}:\\ \;\;\;\;\frac{d \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)\right)}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 45.2% 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}\;d \leq -9.8 \cdot 10^{-142}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-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 -9.8e-142)
   (/ (sqrt (/ d l)) (sqrt (/ h d)))
   (if (<= d -4e-310)
     (/ d (cbrt (pow (* l h) 1.5)))
     (* d (* (pow h -0.5) (pow 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 (d <= -9.8e-142) {
		tmp = sqrt((d / l)) / sqrt((h / d));
	} else if (d <= -4e-310) {
		tmp = d / cbrt(pow((l * h), 1.5));
	} else {
		tmp = d * (pow(h, -0.5) * pow(l, -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 (d <= -9.8e-142) {
		tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
	} else if (d <= -4e-310) {
		tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
	} else {
		tmp = d * (Math.pow(h, -0.5) * Math.pow(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 (d <= -9.8e-142)
		tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d)));
	elseif (d <= -4e-310)
		tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5)));
	else
		tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -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[d, -9.8e-142], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -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 -9.8 \cdot 10^{-142}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\

\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -9.8000000000000007e-142

    1. Initial program 80.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. Simplified78.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow278.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr80.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in D around 0 49.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    7. Step-by-step derivation
      1. *-rgt-identity49.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
      2. *-commutative49.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}} \]
      3. frac-2neg49.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \sqrt{\color{blue}{\frac{-d}{-h}}} \]
      4. sqrt-undiv53.6%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \]
      5. clear-num53.5%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{1}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      6. un-div-inv53.5%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\frac{\sqrt{-h}}{\sqrt{-d}}}} \]
      7. sqrt-undiv50.4%

        \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\color{blue}{\sqrt{\frac{-h}{-d}}}} \]
      8. frac-2neg50.4%

        \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\color{blue}{\frac{h}{d}}}} \]
    8. Applied egg-rr50.4%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}} \]

    if -9.8000000000000007e-142 < d < -3.999999999999988e-310

    1. Initial program 63.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. Simplified60.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. add-sqr-sqrt60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow260.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow160.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow160.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv60.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval60.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr60.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 24.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-124.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval24.9%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr24.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square24.9%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt24.9%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr24.9%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt24.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified24.9%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 24.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative24.9%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/224.9%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log24.9%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp24.9%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod24.9%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out24.9%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg24.9%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow24.9%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/224.9%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/24.9%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity24.9%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified24.9%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Step-by-step derivation
      1. add-cbrt-cube30.5%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{\left(\sqrt{h \cdot \ell} \cdot \sqrt{h \cdot \ell}\right) \cdot \sqrt{h \cdot \ell}}}} \]
      2. pow1/330.5%

        \[\leadsto \frac{d}{\color{blue}{{\left(\left(\sqrt{h \cdot \ell} \cdot \sqrt{h \cdot \ell}\right) \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}}} \]
      3. add-sqr-sqrt30.5%

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(h \cdot \ell\right)} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      4. pow130.5%

        \[\leadsto \frac{d}{{\left(\color{blue}{{\left(h \cdot \ell\right)}^{1}} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      5. pow1/230.5%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{1} \cdot \color{blue}{{\left(h \cdot \ell\right)}^{0.5}}\right)}^{0.3333333333333333}} \]
      6. pow-prod-up30.5%

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(h \cdot \ell\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. metadata-eval30.5%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    13. Applied egg-rr30.5%

      \[\leadsto \frac{d}{\color{blue}{{\left({\left(h \cdot \ell\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    14. Step-by-step derivation
      1. unpow1/330.5%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]
    15. Simplified30.5%

      \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]

    if -3.999999999999988e-310 < d

    1. Initial program 65.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. Simplified64.8%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow264.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow167.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative67.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval67.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow167.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv67.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr66.0%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 34.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-134.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval34.8%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr34.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square34.8%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt34.7%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr34.7%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt34.8%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified34.8%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. *-commutative34.8%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down45.5%

        \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
    10. Applied egg-rr45.5%

      \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification45.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -9.8 \cdot 10^{-142}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 46.1% 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}\;d \leq -8.2 \cdot 10^{-145}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-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 -8.2e-145)
   (* (- d) (sqrt (/ (/ 1.0 l) h)))
   (if (<= d -4e-310)
     (/ d (cbrt (pow (* l h) 1.5)))
     (* d (* (pow h -0.5) (pow 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 (d <= -8.2e-145) {
		tmp = -d * sqrt(((1.0 / l) / h));
	} else if (d <= -4e-310) {
		tmp = d / cbrt(pow((l * h), 1.5));
	} else {
		tmp = d * (pow(h, -0.5) * pow(l, -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 (d <= -8.2e-145) {
		tmp = -d * Math.sqrt(((1.0 / l) / h));
	} else if (d <= -4e-310) {
		tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
	} else {
		tmp = d * (Math.pow(h, -0.5) * Math.pow(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 (d <= -8.2e-145)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h)));
	elseif (d <= -4e-310)
		tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5)));
	else
		tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -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[d, -8.2e-145], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -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 -8.2 \cdot 10^{-145}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\

\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -8.1999999999999995e-145

    1. Initial program 79.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified77.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. add-sqr-sqrt77.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow277.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod77.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow178.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow178.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr79.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in D around 0 48.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    7. 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}}} \]
    8. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      3. associate-/r*0.0%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      4. *-commutative0.0%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      5. unpow20.0%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      6. rem-square-sqrt48.9%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      7. neg-mul-148.9%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left(-d\right)} \]
    9. Simplified48.9%

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)} \]

    if -8.1999999999999995e-145 < d < -3.999999999999988e-310

    1. Initial program 65.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified62.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow262.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow162.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow162.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr62.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 25.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-125.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval25.5%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr25.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square25.6%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt25.6%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr25.6%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt25.6%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified25.6%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 25.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative25.5%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/225.5%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log25.5%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp25.5%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod25.6%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out25.6%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg25.6%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow25.6%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/225.6%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/25.6%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity25.6%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified25.6%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Step-by-step derivation
      1. add-cbrt-cube31.3%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{\left(\sqrt{h \cdot \ell} \cdot \sqrt{h \cdot \ell}\right) \cdot \sqrt{h \cdot \ell}}}} \]
      2. pow1/331.3%

        \[\leadsto \frac{d}{\color{blue}{{\left(\left(\sqrt{h \cdot \ell} \cdot \sqrt{h \cdot \ell}\right) \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}}} \]
      3. add-sqr-sqrt31.3%

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(h \cdot \ell\right)} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      4. pow131.3%

        \[\leadsto \frac{d}{{\left(\color{blue}{{\left(h \cdot \ell\right)}^{1}} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      5. pow1/231.3%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{1} \cdot \color{blue}{{\left(h \cdot \ell\right)}^{0.5}}\right)}^{0.3333333333333333}} \]
      6. pow-prod-up31.3%

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(h \cdot \ell\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. metadata-eval31.3%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    13. Applied egg-rr31.3%

      \[\leadsto \frac{d}{\color{blue}{{\left({\left(h \cdot \ell\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    14. Step-by-step derivation
      1. unpow1/331.3%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]
    15. Simplified31.3%

      \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]

    if -3.999999999999988e-310 < d

    1. Initial program 65.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. Simplified64.8%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow264.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow167.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative67.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval67.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow167.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv67.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr66.0%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 34.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-134.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval34.8%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr34.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square34.8%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt34.7%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr34.7%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt34.8%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified34.8%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. *-commutative34.8%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down45.5%

        \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
    10. Applied egg-rr45.5%

      \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification45.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -8.2 \cdot 10^{-145}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 46.1% 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}\;d \leq -2.1 \cdot 10^{-146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= d -2.1e-146)
   (* (- d) (sqrt (/ (/ 1.0 l) h)))
   (if (<= d -4e-310)
     (/ d (cbrt (pow (* l h) 1.5)))
     (/ d (* (sqrt l) (sqrt h))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= -2.1e-146) {
		tmp = -d * sqrt(((1.0 / l) / h));
	} else if (d <= -4e-310) {
		tmp = d / cbrt(pow((l * h), 1.5));
	} else {
		tmp = d / (sqrt(l) * sqrt(h));
	}
	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 (d <= -2.1e-146) {
		tmp = -d * Math.sqrt(((1.0 / l) / h));
	} else if (d <= -4e-310) {
		tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
	} else {
		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (d <= -2.1e-146)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h)));
	elseif (d <= -4e-310)
		tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5)));
	else
		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
	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[d, -2.1e-146], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.1 \cdot 10^{-146}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\

\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -2.0999999999999999e-146

    1. Initial program 79.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified77.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. add-sqr-sqrt77.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow277.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod77.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow178.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow178.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr79.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in D around 0 48.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    7. 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}}} \]
    8. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      3. associate-/r*0.0%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      4. *-commutative0.0%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      5. unpow20.0%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      6. rem-square-sqrt48.9%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      7. neg-mul-148.9%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left(-d\right)} \]
    9. Simplified48.9%

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)} \]

    if -2.0999999999999999e-146 < d < -3.999999999999988e-310

    1. Initial program 65.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified62.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow262.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow162.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow162.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv62.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval62.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr62.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 25.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-125.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval25.5%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr25.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square25.6%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt25.6%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr25.6%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt25.6%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified25.6%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 25.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative25.5%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/225.5%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log25.5%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp25.5%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod25.6%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out25.6%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg25.6%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow25.6%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/225.6%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/25.6%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity25.6%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified25.6%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Step-by-step derivation
      1. add-cbrt-cube31.3%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{\left(\sqrt{h \cdot \ell} \cdot \sqrt{h \cdot \ell}\right) \cdot \sqrt{h \cdot \ell}}}} \]
      2. pow1/331.3%

        \[\leadsto \frac{d}{\color{blue}{{\left(\left(\sqrt{h \cdot \ell} \cdot \sqrt{h \cdot \ell}\right) \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}}} \]
      3. add-sqr-sqrt31.3%

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(h \cdot \ell\right)} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      4. pow131.3%

        \[\leadsto \frac{d}{{\left(\color{blue}{{\left(h \cdot \ell\right)}^{1}} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      5. pow1/231.3%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{1} \cdot \color{blue}{{\left(h \cdot \ell\right)}^{0.5}}\right)}^{0.3333333333333333}} \]
      6. pow-prod-up31.3%

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(h \cdot \ell\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. metadata-eval31.3%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    13. Applied egg-rr31.3%

      \[\leadsto \frac{d}{\color{blue}{{\left({\left(h \cdot \ell\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    14. Step-by-step derivation
      1. unpow1/331.3%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]
    15. Simplified31.3%

      \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]

    if -3.999999999999988e-310 < d

    1. Initial program 65.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. Simplified64.8%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow264.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow167.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative67.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval67.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow167.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv67.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval66.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr66.0%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 34.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-134.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval34.8%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr34.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square34.8%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt34.7%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr34.7%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt34.8%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified34.8%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. *-commutative34.8%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. metadata-eval34.8%

        \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      3. pow-pow34.8%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}} \]
      4. inv-pow34.8%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{\ell \cdot h}\right)}}^{0.5} \]
      5. pow1/234.8%

        \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{\ell \cdot h}}} \]
      6. sqrt-div34.8%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}} \]
      7. metadata-eval34.8%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}} \]
      8. sqrt-unprod45.4%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      9. div-inv45.4%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      10. associate-/r*43.9%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
    10. Applied egg-rr43.9%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
    11. Step-by-step derivation
      1. associate-/l/45.4%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    12. Simplified45.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification45.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.1 \cdot 10^{-146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 24: 46.2% 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 4.5 \cdot 10^{-203}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= d 4.5e-203)
   (* (- d) (sqrt (/ (/ 1.0 l) h)))
   (/ d (* (sqrt l) (sqrt h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= 4.5e-203) {
		tmp = -d * sqrt(((1.0 / l) / h));
	} else {
		tmp = d / (sqrt(l) * sqrt(h));
	}
	return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (d <= 4.5d-203) then
        tmp = -d * sqrt(((1.0d0 / l) / h))
    else
        tmp = d / (sqrt(l) * sqrt(h))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= 4.5e-203) {
		tmp = -d * Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if d <= 4.5e-203:
		tmp = -d * math.sqrt(((1.0 / l) / h))
	else:
		tmp = d / (math.sqrt(l) * math.sqrt(h))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (d <= 4.5e-203)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h)));
	else
		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (d <= 4.5e-203)
		tmp = -d * sqrt(((1.0 / l) / h));
	else
		tmp = d / (sqrt(l) * sqrt(h));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 4.5e-203], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 4.5 \cdot 10^{-203}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 4.5000000000000002e-203

    1. Initial program 71.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.1%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt70.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow270.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod70.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow170.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative70.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval70.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow170.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv70.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*70.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac70.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative70.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac70.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval70.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr70.7%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in D around 0 35.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    7. 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}}} \]
    8. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      3. associate-/r*0.0%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      4. *-commutative0.0%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      5. unpow20.0%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      6. rem-square-sqrt38.1%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      7. neg-mul-138.1%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left(-d\right)} \]
    9. Simplified38.1%

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)} \]

    if 4.5000000000000002e-203 < d

    1. Initial program 70.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. Simplified69.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt69.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow269.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod69.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow172.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative72.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval72.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow172.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv72.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*71.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac71.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative71.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac71.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval71.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr71.7%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 39.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-139.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval39.3%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr39.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square39.3%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt39.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| \]
      6. fabs-sqr39.2%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt39.3%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified39.3%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. *-commutative39.3%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. metadata-eval39.3%

        \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      3. pow-pow39.3%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}} \]
      4. inv-pow39.3%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{\ell \cdot h}\right)}}^{0.5} \]
      5. pow1/239.3%

        \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{\ell \cdot h}}} \]
      6. sqrt-div39.3%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}} \]
      7. metadata-eval39.3%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}} \]
      8. sqrt-unprod52.4%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      9. div-inv52.4%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      10. associate-/r*50.5%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
    10. Applied egg-rr50.5%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
    11. Step-by-step derivation
      1. associate-/l/52.4%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    12. Simplified52.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 4.5 \cdot 10^{-203}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 25: 41.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} t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{if}\;d \leq -9.8 \cdot 10^{-147}:\\ \;\;\;\;\left(-d\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot t\_0\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (let* ((t_0 (sqrt (/ (/ 1.0 l) h))))
   (if (<= d -9.8e-147) (* (- d) t_0) (* d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = sqrt(((1.0 / l) / h));
	double tmp;
	if (d <= -9.8e-147) {
		tmp = -d * t_0;
	} else {
		tmp = d * t_0;
	}
	return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((1.0d0 / l) / h))
    if (d <= (-9.8d-147)) then
        tmp = -d * t_0
    else
        tmp = d * t_0
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = Math.sqrt(((1.0 / l) / h));
	double tmp;
	if (d <= -9.8e-147) {
		tmp = -d * t_0;
	} else {
		tmp = d * t_0;
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	t_0 = math.sqrt(((1.0 / l) / h))
	tmp = 0
	if d <= -9.8e-147:
		tmp = -d * t_0
	else:
		tmp = d * t_0
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	t_0 = sqrt(Float64(Float64(1.0 / l) / h))
	tmp = 0.0
	if (d <= -9.8e-147)
		tmp = Float64(Float64(-d) * t_0);
	else
		tmp = Float64(d * t_0);
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	t_0 = sqrt(((1.0 / l) / h));
	tmp = 0.0;
	if (d <= -9.8e-147)
		tmp = -d * t_0;
	else
		tmp = d * t_0;
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -9.8e-147], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{if}\;d \leq -9.8 \cdot 10^{-147}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -9.8000000000000001e-147

    1. Initial program 79.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified77.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. add-sqr-sqrt77.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow277.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod77.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow178.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow178.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval79.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr79.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in D around 0 48.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    7. 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}}} \]
    8. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      3. associate-/r*0.0%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      4. *-commutative0.0%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      5. unpow20.0%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      6. rem-square-sqrt48.9%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      7. neg-mul-148.9%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \color{blue}{\left(-d\right)} \]
    9. Simplified48.9%

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)} \]

    if -9.8000000000000001e-147 < d

    1. Initial program 65.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt64.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow264.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod64.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow166.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative66.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval66.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow166.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv66.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*65.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac65.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative65.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac65.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval65.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr65.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 32.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-132.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval32.7%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr32.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square32.7%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt32.6%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr32.6%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt32.7%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified32.7%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 32.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative32.7%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/232.7%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log31.5%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp31.5%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod31.5%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out31.5%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg31.5%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow32.7%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/232.7%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/32.7%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity32.7%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified32.7%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Taylor expanded in d around 0 32.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    13. Step-by-step derivation
      1. *-commutative32.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*32.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    14. Simplified32.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -9.8 \cdot 10^{-147}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 26: 41.7% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= d -1.55e-143)
   (* d (- (pow (* l h) -0.5)))
   (* d (sqrt (/ (/ 1.0 l) h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= -1.55e-143) {
		tmp = d * -pow((l * h), -0.5);
	} else {
		tmp = d * sqrt(((1.0 / l) / h));
	}
	return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (d <= (-1.55d-143)) then
        tmp = d * -((l * h) ** (-0.5d0))
    else
        tmp = d * sqrt(((1.0d0 / l) / h))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= -1.55e-143) {
		tmp = d * -Math.pow((l * h), -0.5);
	} else {
		tmp = d * Math.sqrt(((1.0 / l) / h));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if d <= -1.55e-143:
		tmp = d * -math.pow((l * h), -0.5)
	else:
		tmp = d * math.sqrt(((1.0 / l) / h))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (d <= -1.55e-143)
		tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h)));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (d <= -1.55e-143)
		tmp = d * -((l * h) ^ -0.5);
	else
		tmp = d * sqrt(((1.0 / l) / h));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.55e-143], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.55000000000000004e-143

    1. Initial program 80.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. Simplified78.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow278.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr80.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in l around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. unpow-10.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      3. metadata-eval0.0%

        \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      4. pow-sqr0.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      5. rem-sqrt-square0.0%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      6. rem-square-sqrt0.0%

        \[\leadsto \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      7. fabs-sqr0.0%

        \[\leadsto \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      8. rem-square-sqrt0.0%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      9. *-commutative0.0%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      10. unpow20.0%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      11. rem-square-sqrt48.2%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      12. mul-1-neg48.2%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left(-d\right)} \]
    8. Simplified48.2%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]

    if -1.55000000000000004e-143 < d

    1. Initial program 65.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. Simplified63.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt63.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow263.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod63.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow165.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow165.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr64.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-132.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval32.5%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr32.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square32.5%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt32.4%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr32.4%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt32.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified32.5%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative32.5%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/232.5%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log31.3%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp31.3%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod31.3%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out31.3%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg31.3%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow32.5%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/232.5%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/32.5%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity32.5%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified32.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Taylor expanded in d around 0 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    13. Step-by-step derivation
      1. *-commutative32.5%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*32.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    14. Simplified32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 27: 41.7% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.76 \cdot 10^{-143}:\\ \;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \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.76e-143) (/ d (- (sqrt (* l h)))) (* d (sqrt (/ (/ 1.0 l) h)))))
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.76e-143) {
		tmp = d / -sqrt((l * h));
	} else {
		tmp = d * sqrt(((1.0 / l) / h));
	}
	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.76d-143)) then
        tmp = d / -sqrt((l * h))
    else
        tmp = d * sqrt(((1.0d0 / l) / h))
    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.76e-143) {
		tmp = d / -Math.sqrt((l * h));
	} else {
		tmp = d * Math.sqrt(((1.0 / l) / h));
	}
	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.76e-143:
		tmp = d / -math.sqrt((l * h))
	else:
		tmp = d * math.sqrt(((1.0 / l) / h))
	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.76e-143)
		tmp = Float64(d / Float64(-sqrt(Float64(l * h))));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h)));
	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.76e-143)
		tmp = d / -sqrt((l * h));
	else
		tmp = d * sqrt(((1.0 / l) / h));
	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.76e-143], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_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.76 \cdot 10^{-143}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.76000000000000005e-143

    1. Initial program 80.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. Simplified78.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow278.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr80.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 6.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-16.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval6.3%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr6.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square6.3%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt6.3%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr6.3%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt6.3%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified6.3%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. 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}}} \]
    10. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt48.2%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. mul-1-neg48.2%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. distribute-rgt-neg-out48.2%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      6. *-commutative48.2%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      7. unpow1/248.2%

        \[\leadsto -\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      8. rem-exp-log45.3%

        \[\leadsto -{\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      9. rec-exp45.3%

        \[\leadsto -{\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      10. exp-prod45.3%

        \[\leadsto -\color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      11. distribute-lft-neg-out45.3%

        \[\leadsto -e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      12. exp-neg45.3%

        \[\leadsto -\color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      13. exp-to-pow48.1%

        \[\leadsto -\frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      14. unpow1/248.1%

        \[\leadsto -\frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      15. associate-*l/48.2%

        \[\leadsto -\color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      16. *-lft-identity48.2%

        \[\leadsto -\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      17. distribute-frac-neg248.2%

        \[\leadsto \color{blue}{\frac{d}{-\sqrt{h \cdot \ell}}} \]
    11. Simplified48.2%

      \[\leadsto \color{blue}{\frac{d}{-\sqrt{h \cdot \ell}}} \]

    if -1.76000000000000005e-143 < d

    1. Initial program 65.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. Simplified63.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt63.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow263.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod63.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow165.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow165.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr64.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-132.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval32.5%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr32.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square32.5%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt32.4%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr32.4%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt32.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified32.5%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative32.5%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/232.5%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log31.3%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp31.3%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod31.3%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out31.3%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg31.3%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow32.5%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/232.5%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/32.5%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity32.5%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified32.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    12. Taylor expanded in d around 0 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    13. Step-by-step derivation
      1. *-commutative32.5%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*32.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    14. Simplified32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification38.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.76 \cdot 10^{-143}:\\ \;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 28: 41.7% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\ \;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= d -1.55e-143) (/ d (- (sqrt (* l h)))) (* d (sqrt (/ (/ 1.0 h) l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= -1.55e-143) {
		tmp = d / -sqrt((l * h));
	} else {
		tmp = d * sqrt(((1.0 / h) / l));
	}
	return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (d <= (-1.55d-143)) then
        tmp = d / -sqrt((l * h))
    else
        tmp = d * sqrt(((1.0d0 / h) / l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= -1.55e-143) {
		tmp = d / -Math.sqrt((l * h));
	} else {
		tmp = d * Math.sqrt(((1.0 / h) / l));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if d <= -1.55e-143:
		tmp = d / -math.sqrt((l * h))
	else:
		tmp = d * math.sqrt(((1.0 / h) / l))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (d <= -1.55e-143)
		tmp = Float64(d / Float64(-sqrt(Float64(l * h))));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l)));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (d <= -1.55e-143)
		tmp = d / -sqrt((l * h));
	else
		tmp = d * sqrt(((1.0 / h) / l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.55e-143], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.55000000000000004e-143

    1. Initial program 80.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. Simplified78.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow278.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr80.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 6.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-16.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval6.3%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr6.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square6.3%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt6.3%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr6.3%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt6.3%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified6.3%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. 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}}} \]
    10. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt48.2%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. mul-1-neg48.2%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. distribute-rgt-neg-out48.2%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      6. *-commutative48.2%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      7. unpow1/248.2%

        \[\leadsto -\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      8. rem-exp-log45.3%

        \[\leadsto -{\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      9. rec-exp45.3%

        \[\leadsto -{\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      10. exp-prod45.3%

        \[\leadsto -\color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      11. distribute-lft-neg-out45.3%

        \[\leadsto -e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      12. exp-neg45.3%

        \[\leadsto -\color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      13. exp-to-pow48.1%

        \[\leadsto -\frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      14. unpow1/248.1%

        \[\leadsto -\frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      15. associate-*l/48.2%

        \[\leadsto -\color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      16. *-lft-identity48.2%

        \[\leadsto -\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      17. distribute-frac-neg248.2%

        \[\leadsto \color{blue}{\frac{d}{-\sqrt{h \cdot \ell}}} \]
    11. Simplified48.2%

      \[\leadsto \color{blue}{\frac{d}{-\sqrt{h \cdot \ell}}} \]

    if -1.55000000000000004e-143 < d

    1. Initial program 65.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. Simplified63.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt63.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow263.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod63.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow165.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow165.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr64.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-132.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval32.5%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr32.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square32.5%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt32.4%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr32.4%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt32.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified32.5%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. associate-/r*32.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    11. Simplified32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification38.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\ \;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 29: 41.6% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\ \;\;\;\;\frac{d}{-t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{t\_0}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (let* ((t_0 (sqrt (* l h)))) (if (<= d -1.55e-143) (/ d (- t_0)) (/ d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = sqrt((l * h));
	double tmp;
	if (d <= -1.55e-143) {
		tmp = d / -t_0;
	} else {
		tmp = d / t_0;
	}
	return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((l * h))
    if (d <= (-1.55d-143)) then
        tmp = d / -t_0
    else
        tmp = d / t_0
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = Math.sqrt((l * h));
	double tmp;
	if (d <= -1.55e-143) {
		tmp = d / -t_0;
	} else {
		tmp = d / t_0;
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	t_0 = math.sqrt((l * h))
	tmp = 0
	if d <= -1.55e-143:
		tmp = d / -t_0
	else:
		tmp = d / t_0
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	t_0 = sqrt(Float64(l * h))
	tmp = 0.0
	if (d <= -1.55e-143)
		tmp = Float64(d / Float64(-t_0));
	else
		tmp = Float64(d / t_0);
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	t_0 = sqrt((l * h));
	tmp = 0.0;
	if (d <= -1.55e-143)
		tmp = d / -t_0;
	else
		tmp = d / t_0;
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.55e-143], N[(d / (-t$95$0)), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\
\;\;\;\;\frac{d}{-t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.55000000000000004e-143

    1. Initial program 80.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. Simplified78.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow278.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod78.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow179.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv79.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval80.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr80.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 6.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-16.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval6.3%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr6.3%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square6.3%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt6.3%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr6.3%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt6.3%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified6.3%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. 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}}} \]
    10. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt48.2%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. mul-1-neg48.2%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. distribute-rgt-neg-out48.2%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      6. *-commutative48.2%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      7. unpow1/248.2%

        \[\leadsto -\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      8. rem-exp-log45.3%

        \[\leadsto -{\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      9. rec-exp45.3%

        \[\leadsto -{\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      10. exp-prod45.3%

        \[\leadsto -\color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      11. distribute-lft-neg-out45.3%

        \[\leadsto -e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      12. exp-neg45.3%

        \[\leadsto -\color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      13. exp-to-pow48.1%

        \[\leadsto -\frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      14. unpow1/248.1%

        \[\leadsto -\frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      15. associate-*l/48.2%

        \[\leadsto -\color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      16. *-lft-identity48.2%

        \[\leadsto -\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      17. distribute-frac-neg248.2%

        \[\leadsto \color{blue}{\frac{d}{-\sqrt{h \cdot \ell}}} \]
    11. Simplified48.2%

      \[\leadsto \color{blue}{\frac{d}{-\sqrt{h \cdot \ell}}} \]

    if -1.55000000000000004e-143 < d

    1. Initial program 65.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. Simplified63.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt63.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
      2. pow263.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
      3. sqrt-prod63.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
      4. sqrt-pow165.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      5. *-commutative65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. metadata-eval65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      7. pow165.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      8. div-inv65.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      9. associate-*l*64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      10. times-frac64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      11. *-commutative64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      12. times-frac64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      13. metadata-eval64.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. Applied egg-rr64.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
    6. Taylor expanded in d around inf 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow-132.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. metadata-eval32.5%

        \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr32.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
      4. rem-sqrt-square32.5%

        \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
      5. rem-square-sqrt32.4%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
      6. fabs-sqr32.4%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
      7. rem-square-sqrt32.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified32.5%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Taylor expanded in d around 0 32.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    10. Step-by-step derivation
      1. *-commutative32.5%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. unpow1/232.5%

        \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      3. rem-exp-log31.3%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      4. rec-exp31.3%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      5. exp-prod31.3%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      6. distribute-lft-neg-out31.3%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      7. exp-neg31.3%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
      8. exp-to-pow32.5%

        \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
      9. unpow1/232.5%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      10. associate-*l/32.5%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      11. *-lft-identity32.5%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    11. Simplified32.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification38.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\ \;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 30: 25.9% accurate, 3.2× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* l h))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	return d / sqrt((l * h));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    code = d / sqrt((l * h))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	return d / Math.sqrt((l * h));
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	return d / math.sqrt((l * h))
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	return Float64(d / sqrt(Float64(l * h)))
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
	tmp = d / sqrt((l * h));
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 71.3%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified69.8%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. add-sqr-sqrt69.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \cdot \sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}\right) \]
    2. pow269.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
    3. sqrt-prod69.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}} \cdot \sqrt{\frac{h}{\ell}}\right)}}^{2}\right) \]
    4. sqrt-pow171.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    5. *-commutative71.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}}^{\left(\frac{2}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    6. metadata-eval71.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    7. pow171.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    8. div-inv71.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \frac{M}{2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    9. associate-*l*71.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\color{blue}{\left(D \cdot \left(\frac{1}{d} \cdot \frac{M}{2}\right)\right)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    10. times-frac71.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\frac{1 \cdot M}{d \cdot 2}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    11. *-commutative71.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \frac{1 \cdot M}{\color{blue}{2 \cdot d}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    12. times-frac71.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{M}{d}\right)}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    13. metadata-eval71.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
  5. Applied egg-rr71.1%

    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{{\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}}\right) \]
  6. Taylor expanded in d around inf 21.7%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  7. Step-by-step derivation
    1. unpow-121.7%

      \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
    2. metadata-eval21.7%

      \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
    3. pow-sqr21.7%

      \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
    4. rem-sqrt-square21.7%

      \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
    5. rem-square-sqrt21.7%

      \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
    6. fabs-sqr21.7%

      \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
    7. rem-square-sqrt21.7%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  8. Simplified21.7%

    \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
  9. Taylor expanded in d around 0 21.7%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  10. Step-by-step derivation
    1. *-commutative21.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
    2. unpow1/221.7%

      \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
    3. rem-exp-log21.0%

      \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
    4. rec-exp21.1%

      \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
    5. exp-prod21.1%

      \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
    6. distribute-lft-neg-out21.1%

      \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
    7. exp-neg21.1%

      \[\leadsto \color{blue}{\frac{1}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \cdot d \]
    8. exp-to-pow21.7%

      \[\leadsto \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \cdot d \]
    9. unpow1/221.7%

      \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
    10. associate-*l/21.7%

      \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
    11. *-lft-identity21.7%

      \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
  11. Simplified21.7%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  12. Final simplification21.7%

    \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
  13. Add Preprocessing

Reproduce

?
herbie shell --seed 2024150 
(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)))))