Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.5% → 71.4%
Time: 20.9s
Alternatives: 18
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 18 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: 66.5% accurate, 1.0× speedup?

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

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

Alternative 1: 71.4% accurate, 0.6× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;d \leq -1 \cdot 10^{-191}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\frac{\ell}{h}}, 1\right)\right)\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{-295}:\\ \;\;\;\;-0.125 \cdot {\left({\left(\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \sqrt{h \cdot {\ell}^{-3}}\right)}^{3}\right)}^{0.3333333333333333}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))))
   (if (<= d -1e-191)
     (*
      (sqrt (/ d h))
      (* t_0 (fma (pow (* M (/ (/ D d) 2.0)) 2.0) (/ -0.5 (/ l h)) 1.0)))
     (if (<= d 2.6e-295)
       (*
        -0.125
        (pow
         (pow (* (/ (pow (* M D) 2.0) d) (sqrt (* h (pow l -3.0)))) 3.0)
         0.3333333333333333))
       (*
        (/ (sqrt d) (sqrt h))
        (*
         t_0
         (- 1.0 (* 0.5 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (/ h l))))))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double tmp;
	if (d <= -1e-191) {
		tmp = sqrt((d / h)) * (t_0 * fma(pow((M * ((D / d) / 2.0)), 2.0), (-0.5 / (l / h)), 1.0));
	} else if (d <= 2.6e-295) {
		tmp = -0.125 * pow(pow(((pow((M * D), 2.0) / d) * sqrt((h * pow(l, -3.0)))), 3.0), 0.3333333333333333);
	} else {
		tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * (pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
	}
	return tmp;
}
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	tmp = 0.0
	if (d <= -1e-191)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * fma((Float64(M * Float64(Float64(D / d) / 2.0)) ^ 2.0), Float64(-0.5 / Float64(l / h)), 1.0)));
	elseif (d <= 2.6e-295)
		tmp = Float64(-0.125 * ((Float64(Float64((Float64(M * D) ^ 2.0) / d) * sqrt(Float64(h * (l ^ -3.0)))) ^ 3.0) ^ 0.3333333333333333));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(h / l))))));
	end
	return tmp
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1e-191], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(N[Power[N[(M * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-295], N[(-0.125 * N[Power[N[Power[N[(N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1 \cdot 10^{-191}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\frac{\ell}{h}}, 1\right)\right)\\

\mathbf{elif}\;d \leq 2.6 \cdot 10^{-295}:\\
\;\;\;\;-0.125 \cdot {\left({\left(\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \sqrt{h \cdot {\ell}^{-3}}\right)}^{3}\right)}^{0.3333333333333333}\\

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


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

    1. Initial program 74.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*74.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e-191 < d < 2.59999999999999985e-295

    1. Initial program 23.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. Step-by-step derivation
      1. associate-*l*23.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.59999999999999985e-295 < d

    1. Initial program 65.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. Step-by-step derivation
      1. associate-*l*64.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1 \cdot 10^{-191}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\frac{\ell}{h}}, 1\right)\right)\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{-295}:\\ \;\;\;\;-0.125 \cdot {\left({\left(\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \sqrt{h \cdot {\ell}^{-3}}\right)}^{3}\right)}^{0.3333333333333333}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\ \end{array} \]

Alternative 2: 68.5% accurate, 0.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 1.99999999999999993e278

    1. Initial program 87.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) \]

    if 1.99999999999999993e278 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l))))

    1. Initial program 18.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. Step-by-step derivation
      1. metadata-eval18.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.125 \cdot \frac{\frac{D \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\frac{d}{D}}}{\ell}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.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{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 2 \cdot 10^{+278}:\\ \;\;\;\;\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{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.125 \cdot \frac{\frac{D \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\frac{d}{D}}}{\ell}\right)\\ \end{array} \]

Alternative 3: 70.8% accurate, 0.8× speedup?

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

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


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

    1. Initial program 68.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. Step-by-step derivation
      1. associate-*l*68.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.00000000000000024e-300 < d

    1. Initial program 64.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. Step-by-step derivation
      1. associate-*l*64.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3 \cdot 10^{-300}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\frac{\ell}{h}}, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\ \end{array} \]

Alternative 4: 68.0% accurate, 1.0× speedup?

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

\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+85}:\\
\;\;\;\;\left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.125 \cdot \frac{\frac{D}{\frac{d}{D}} \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\ell}\right)\\

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


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

    1. Initial program 68.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. Step-by-step derivation
      1. metadata-eval68.8%

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

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

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

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

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

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

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

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

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

    if 8.9999999999999994e-283 < l < 4.79999999999999993e85

    1. Initial program 72.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. metadata-eval72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.79999999999999993e85 < l

    1. Initial program 52.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. Step-by-step derivation
      1. associate-*l*52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 9 \cdot 10^{-283}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\\ \mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+85}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.125 \cdot \frac{\frac{D}{\frac{d}{D}} \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 5: 67.5% accurate, 1.0× speedup?

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

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


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

    1. Initial program 70.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. Step-by-step derivation
      1. metadata-eval70.1%

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

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

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

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

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

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

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

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

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

    if 5.4999999999999999e-184 < h

    1. Initial program 61.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. metadata-eval61.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq 5.5 \cdot 10^{-184}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.125 \cdot \frac{\frac{D \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\frac{d}{D}}}{\ell}\right)\\ \end{array} \]

Alternative 6: 62.4% accurate, 1.0× speedup?

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

\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{-92}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \mathsf{fma}\left(h, {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)\\

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


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

    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. Step-by-step derivation
      1. metadata-eval70.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999972e-158 < l < 1.80000000000000008e-92

    1. Initial program 68.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. Step-by-step derivation
      1. associate-*l*66.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.80000000000000008e-92 < l

    1. Initial program 60.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. Step-by-step derivation
      1. associate-*l*60.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-158}:\\ \;\;\;\;\left(1 - 0.125 \cdot \frac{\frac{D \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\frac{d}{D}}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{elif}\;\ell \leq 1.8 \cdot 10^{-92}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \mathsf{fma}\left(h, {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 7: 67.7% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 2.8e122

    1. Initial program 69.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. Step-by-step derivation
      1. associate-*l*69.3%

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

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

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

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

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

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

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

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

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

    if 2.8e122 < l

    1. Initial program 50.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. Step-by-step derivation
      1. associate-*l*50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 67.8% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 2.99999999999999986e122

    1. Initial program 69.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. Step-by-step derivation
      1. metadata-eval69.7%

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

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

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

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

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

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

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

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

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

    if 2.99999999999999986e122 < l

    1. Initial program 50.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. Step-by-step derivation
      1. associate-*l*50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 61.0% accurate, 1.4× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 3.1999999999999999e100

    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. Step-by-step derivation
      1. metadata-eval65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{0.125 \cdot \frac{\frac{D}{\frac{d}{D}} \cdot \left(h \cdot \left(\frac{M}{d} \cdot M\right)\right)}{\ell}}\right) \]
    9. Taylor expanded in h around 0 55.7%

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

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

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

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

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

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

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

    if 3.1999999999999999e100 < D

    1. Initial program 75.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. Step-by-step derivation
      1. associate-*l*75.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 60.8% accurate, 1.4× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 5.29999999999999997e98

    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. Step-by-step derivation
      1. metadata-eval65.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.29999999999999997e98 < D

    1. Initial program 73.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. Step-by-step derivation
      1. associate-*l*73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 56.7% accurate, 1.5× speedup?

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

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


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

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*69.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.25000000000000011e-112 < l

    1. Initial program 59.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*59.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    6. Simplified60.5%

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

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

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

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

Alternative 12: 47.4% accurate, 1.5× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.18 \cdot 10^{-265}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-307}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-122}:\\ \;\;\;\;-0.125 \cdot \left(\sqrt{h \cdot {\ell}^{-3}} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -1.18e-265)
   (* (sqrt (/ d h)) (sqrt (/ d l)))
   (if (<= l 1.4e-307)
     (/ d (cbrt (pow (* h l) 1.5)))
     (if (<= l 1.3e-122)
       (* -0.125 (* (sqrt (* h (pow l -3.0))) (/ (* (* M D) (* M D)) d)))
       (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.18e-265) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (l <= 1.4e-307) {
		tmp = d / cbrt(pow((h * l), 1.5));
	} else if (l <= 1.3e-122) {
		tmp = -0.125 * (sqrt((h * pow(l, -3.0))) * (((M * D) * (M * D)) / d));
	} else {
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	}
	return tmp;
}
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.18e-265) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (l <= 1.4e-307) {
		tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
	} else if (l <= 1.3e-122) {
		tmp = -0.125 * (Math.sqrt((h * Math.pow(l, -3.0))) * (((M * D) * (M * D)) / d));
	} else {
		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
	}
	return tmp;
}
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -1.18e-265)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (l <= 1.4e-307)
		tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5)));
	elseif (l <= 1.3e-122)
		tmp = Float64(-0.125 * Float64(sqrt(Float64(h * (l ^ -3.0))) * Float64(Float64(Float64(M * D) * Float64(M * D)) / d)));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
	end
	return tmp
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.18e-265], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.4e-307], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e-122], N[(-0.125 * N[(N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.18 \cdot 10^{-265}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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

\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-122}:\\
\;\;\;\;-0.125 \cdot \left(\sqrt{h \cdot {\ell}^{-3}} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d}\right)\\

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


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

    1. Initial program 67.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. Step-by-step derivation
      1. associate-*l*67.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.18000000000000005e-265 < l < 1.4e-307

    1. Initial program 63.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*63.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-307 < l < 1.29999999999999988e-122

    1. Initial program 79.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. Step-by-step derivation
      1. associate-*l*76.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.125 \cdot \left(\frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d} \cdot \sqrt{\color{blue}{e^{\mathsf{log1p}\left(\frac{h}{{\ell}^{3}}\right)} - 1}}\right) \]
      3. div-inv62.9%

        \[\leadsto -0.125 \cdot \left(\frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d} \cdot \sqrt{e^{\mathsf{log1p}\left(\color{blue}{h \cdot \frac{1}{{\ell}^{3}}}\right)} - 1}\right) \]
      4. pow-flip62.9%

        \[\leadsto -0.125 \cdot \left(\frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d} \cdot \sqrt{e^{\mathsf{log1p}\left(h \cdot \color{blue}{{\ell}^{\left(-3\right)}}\right)} - 1}\right) \]
      5. metadata-eval62.9%

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

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

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

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

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

    if 1.29999999999999988e-122 < l

    1. Initial program 59.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*59.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    6. Simplified60.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.18 \cdot 10^{-265}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-307}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-122}:\\ \;\;\;\;-0.125 \cdot \left(\sqrt{h \cdot {\ell}^{-3}} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 13: 48.1% accurate, 1.5× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -6.2 \cdot 10^{-268}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-307}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{elif}\;\ell \leq 8 \cdot 10^{-103}:\\ \;\;\;\;-0.125 \cdot \left(\frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -6.2e-268)
   (* (sqrt (/ d h)) (sqrt (/ d l)))
   (if (<= l 1.4e-307)
     (/ d (cbrt (pow (* h l) 1.5)))
     (if (<= l 8e-103)
       (* -0.125 (* (/ (* (* M D) (* M D)) d) (/ (sqrt h) (pow l 1.5))))
       (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -6.2e-268) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (l <= 1.4e-307) {
		tmp = d / cbrt(pow((h * l), 1.5));
	} else if (l <= 8e-103) {
		tmp = -0.125 * ((((M * D) * (M * D)) / d) * (sqrt(h) / pow(l, 1.5)));
	} else {
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	}
	return tmp;
}
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -6.2e-268) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (l <= 1.4e-307) {
		tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
	} else if (l <= 8e-103) {
		tmp = -0.125 * ((((M * D) * (M * D)) / d) * (Math.sqrt(h) / Math.pow(l, 1.5)));
	} else {
		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
	}
	return tmp;
}
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -6.2e-268)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (l <= 1.4e-307)
		tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5)));
	elseif (l <= 8e-103)
		tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) / d) * Float64(sqrt(h) / (l ^ 1.5))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
	end
	return tmp
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.2e-268], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.4e-307], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e-103], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{-268}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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

\mathbf{elif}\;\ell \leq 8 \cdot 10^{-103}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\

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


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

    1. Initial program 67.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. Step-by-step derivation
      1. associate-*l*67.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.1999999999999996e-268 < l < 1.4e-307

    1. Initial program 63.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*63.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-307 < l < 7.99999999999999966e-103

    1. Initial program 77.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. Step-by-step derivation
      1. associate-*l*75.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.99999999999999966e-103 < l

    1. Initial program 60.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. Step-by-step derivation
      1. associate-*l*60.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative60.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -6.2 \cdot 10^{-268}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-307}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{elif}\;\ell \leq 8 \cdot 10^{-103}:\\ \;\;\;\;-0.125 \cdot \left(\frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 14: 44.7% accurate, 1.6× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.5 \cdot 10^{-80}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -1.5e-80)
   (* (sqrt (/ d h)) (sqrt (/ d l)))
   (if (<= d -2e-310)
     (/ d (cbrt (pow (* h l) 1.5)))
     (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.5e-80) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (d <= -2e-310) {
		tmp = d / cbrt(pow((h * l), 1.5));
	} else {
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	}
	return tmp;
}
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.5e-80) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (d <= -2e-310) {
		tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
	} else {
		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
	}
	return tmp;
}
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -1.5e-80)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (d <= -2e-310)
		tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5)));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
	end
	return tmp
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.5e-80], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.5 \cdot 10^{-80}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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

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


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

    1. Initial program 75.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. Step-by-step derivation
      1. associate-*l*75.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.50000000000000004e-80 < d < -1.999999999999994e-310

    1. Initial program 48.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. Step-by-step derivation
      1. associate-*l*48.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < 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. Step-by-step derivation
      1. associate-*l*64.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    6. Simplified45.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.5 \cdot 10^{-80}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 15: 31.2% accurate, 1.6× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.4 \cdot 10^{-307}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l 1.4e-307)
   (/ d (cbrt (pow (* h l) 1.5)))
   (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= 1.4e-307) {
		tmp = d / cbrt(pow((h * l), 1.5));
	} else {
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	}
	return tmp;
}
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= 1.4e-307) {
		tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
	} else {
		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
	}
	return tmp;
}
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= 1.4e-307)
		tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5)));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
	end
	return tmp
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.4e-307], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.4 \cdot 10^{-307}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\

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


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

    1. Initial program 67.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-307 < 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. Step-by-step derivation
      1. associate-*l*65.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative44.9%

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    6. Simplified45.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.4 \cdot 10^{-307}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 16: 31.2% accurate, 1.6× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= h -5e-310)
   (/ d (cbrt (pow (* h l) 1.5)))
   (/ d (* (sqrt h) (sqrt l)))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -5e-310) {
		tmp = d / cbrt(pow((h * l), 1.5));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -5e-310) {
		tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (h <= -5e-310)
		tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5)));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5e-310], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\

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


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

    1. Initial program 67.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*67.8%

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      3. unpow1/267.8%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      4. metadata-eval67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/267.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac68.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified68.7%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in d around inf 10.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. pow110.2%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)}^{1}} \]
      2. *-commutative10.2%

        \[\leadsto {\color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}}^{1} \]
      3. sqrt-div10.2%

        \[\leadsto {\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)}^{1} \]
      4. metadata-eval10.2%

        \[\leadsto {\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)}^{1} \]
      5. *-commutative10.2%

        \[\leadsto {\left(d \cdot \frac{1}{\sqrt{\color{blue}{h \cdot \ell}}}\right)}^{1} \]
    6. Applied egg-rr10.2%

      \[\leadsto \color{blue}{{\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    7. Step-by-step derivation
      1. unpow110.2%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      2. associate-*r/10.2%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      3. *-rgt-identity10.2%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    8. Simplified10.2%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    9. Step-by-step derivation
      1. add-cbrt-cube13.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/313.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-sqrt13.3%

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(h \cdot \ell\right)} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      4. pow113.3%

        \[\leadsto \frac{d}{{\left(\color{blue}{{\left(h \cdot \ell\right)}^{1}} \cdot \sqrt{h \cdot \ell}\right)}^{0.3333333333333333}} \]
      5. pow1/213.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-up13.3%

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(h \cdot \ell\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. metadata-eval13.3%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    10. Applied egg-rr13.3%

      \[\leadsto \frac{d}{\color{blue}{{\left({\left(h \cdot \ell\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    11. Step-by-step derivation
      1. unpow1/313.3%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]
    12. Simplified13.3%

      \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]

    if -4.999999999999985e-310 < h

    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. Step-by-step derivation
      1. associate-*l*64.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)} \]
      2. metadata-eval64.6%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      3. unpow1/264.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      4. metadata-eval64.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/264.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*64.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval64.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac63.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified63.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in d around inf 45.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. pow145.3%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)}^{1}} \]
      2. *-commutative45.3%

        \[\leadsto {\color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}}^{1} \]
      3. sqrt-div45.9%

        \[\leadsto {\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)}^{1} \]
      4. metadata-eval45.9%

        \[\leadsto {\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)}^{1} \]
      5. *-commutative45.9%

        \[\leadsto {\left(d \cdot \frac{1}{\sqrt{\color{blue}{h \cdot \ell}}}\right)}^{1} \]
    6. Applied egg-rr45.9%

      \[\leadsto \color{blue}{{\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    7. Step-by-step derivation
      1. unpow145.9%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      2. associate-*r/46.1%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      3. *-rgt-identity46.1%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    8. Simplified46.1%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    9. Step-by-step derivation
      1. *-commutative46.1%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
      2. sqrt-prod51.8%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
    10. Applied egg-rr51.8%

      \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification33.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]

Alternative 17: 29.5% accurate, 1.6× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= h -5e-310) (/ d (sqrt (* h l))) (/ d (* (sqrt h) (sqrt l)))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -5e-310) {
		tmp = d / sqrt((h * l));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
    real(8) :: tmp
    if (h <= (-5d-310)) then
        tmp = d / sqrt((h * l))
    else
        tmp = d / (sqrt(h) * sqrt(l))
    end if
    code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -5e-310) {
		tmp = d / Math.sqrt((h * l));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if h <= -5e-310:
		tmp = d / math.sqrt((h * l))
	else:
		tmp = d / (math.sqrt(h) * math.sqrt(l))
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (h <= -5e-310)
		tmp = Float64(d / sqrt(Float64(h * l)));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (h <= -5e-310)
		tmp = d / sqrt((h * l));
	else
		tmp = d / (sqrt(h) * sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5e-310], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < -4.999999999999985e-310

    1. Initial program 67.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*67.8%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)} \]
      2. metadata-eval67.8%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      3. unpow1/267.8%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      4. metadata-eval67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/267.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac68.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified68.7%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in d around inf 10.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. pow110.2%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)}^{1}} \]
      2. *-commutative10.2%

        \[\leadsto {\color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}}^{1} \]
      3. sqrt-div10.2%

        \[\leadsto {\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)}^{1} \]
      4. metadata-eval10.2%

        \[\leadsto {\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)}^{1} \]
      5. *-commutative10.2%

        \[\leadsto {\left(d \cdot \frac{1}{\sqrt{\color{blue}{h \cdot \ell}}}\right)}^{1} \]
    6. Applied egg-rr10.2%

      \[\leadsto \color{blue}{{\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    7. Step-by-step derivation
      1. unpow110.2%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      2. associate-*r/10.2%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      3. *-rgt-identity10.2%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    8. Simplified10.2%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]

    if -4.999999999999985e-310 < h

    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. Step-by-step derivation
      1. associate-*l*64.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)} \]
      2. metadata-eval64.6%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      3. unpow1/264.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      4. metadata-eval64.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/264.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*64.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval64.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac63.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified63.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in d around inf 45.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. pow145.3%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)}^{1}} \]
      2. *-commutative45.3%

        \[\leadsto {\color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}}^{1} \]
      3. sqrt-div45.9%

        \[\leadsto {\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)}^{1} \]
      4. metadata-eval45.9%

        \[\leadsto {\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)}^{1} \]
      5. *-commutative45.9%

        \[\leadsto {\left(d \cdot \frac{1}{\sqrt{\color{blue}{h \cdot \ell}}}\right)}^{1} \]
    6. Applied egg-rr45.9%

      \[\leadsto \color{blue}{{\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    7. Step-by-step derivation
      1. unpow145.9%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      2. associate-*r/46.1%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      3. *-rgt-identity46.1%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    8. Simplified46.1%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    9. Step-by-step derivation
      1. *-commutative46.1%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
      2. sqrt-prod51.8%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
    10. Applied egg-rr51.8%

      \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]

Alternative 18: 25.5% accurate, 3.2× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \frac{d}{\sqrt{h \cdot \ell}} \end{array} \]
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	return d / sqrt((h * l));
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 / sqrt((h * l))
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	return d / Math.sqrt((h * l));
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	return d / math.sqrt((h * l))
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	return Float64(d / sqrt(Float64(h * l)))
end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
	tmp = d / sqrt((h * l));
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Derivation
  1. Initial program 66.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. Step-by-step derivation
    1. associate-*l*66.2%

      \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)} \]
    2. metadata-eval66.2%

      \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
    3. unpow1/266.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
    4. metadata-eval66.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
    5. unpow1/266.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
    6. associate-*l*66.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
    7. metadata-eval66.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    8. times-frac65.8%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
  3. Simplified65.8%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
  4. Taylor expanded in d around inf 28.2%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  5. Step-by-step derivation
    1. pow128.2%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)}^{1}} \]
    2. *-commutative28.2%

      \[\leadsto {\color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}}^{1} \]
    3. sqrt-div28.5%

      \[\leadsto {\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)}^{1} \]
    4. metadata-eval28.5%

      \[\leadsto {\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)}^{1} \]
    5. *-commutative28.5%

      \[\leadsto {\left(d \cdot \frac{1}{\sqrt{\color{blue}{h \cdot \ell}}}\right)}^{1} \]
  6. Applied egg-rr28.5%

    \[\leadsto \color{blue}{{\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
  7. Step-by-step derivation
    1. unpow128.5%

      \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
    2. associate-*r/28.6%

      \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
    3. *-rgt-identity28.6%

      \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
  8. Simplified28.6%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  9. Final simplification28.6%

    \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]

Reproduce

?
herbie shell --seed 2023192 
(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)))))