Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.3% → 83.6%
Time: 27.2s
Alternatives: 16
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 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.3% accurate, 1.0× speedup?

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

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

Alternative 1: 83.6% accurate, 0.6× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\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
 (if (<= d -5e-310)
   (*
    (/ (sqrt (- d)) (sqrt (- h)))
    (*
     (sqrt (/ d l))
     (- 1.0 (* 0.5 (* h (/ (pow (* M (* 0.5 (/ D d))) 2.0) l))))))
   (*
    (/ (sqrt d) (sqrt h))
    (*
     (/ (sqrt d) (sqrt l))
     (- 1.0 (* 0.5 (/ h (/ l (pow (/ (* M D) (* d 2.0)) 2.0)))))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -5e-310) {
		tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * (h * (pow((M * (0.5 * (D / d))), 2.0) / l)))));
	} else {
		tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (h / (l / pow(((M * D) / (d * 2.0)), 2.0))))));
	}
	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 <= (-5d-310)) then
        tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (h * (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) / l)))))
    else
        tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * (h / (l / (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))))
    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 <= -5e-310) {
		tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (h * (Math.pow((M * (0.5 * (D / d))), 2.0) / l)))));
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (h / (l / Math.pow(((M * D) / (d * 2.0)), 2.0))))));
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if d <= -5e-310:
		tmp = (math.sqrt(-d) / math.sqrt(-h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (h * (math.pow((M * (0.5 * (D / d))), 2.0) / l)))))
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (h / (l / math.pow(((M * D) / (d * 2.0)), 2.0))))))
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -5e-310)
		tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) / l))))));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))));
	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 <= -5e-310)
		tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * (h * (((M * (0.5 * (D / d))) ^ 2.0) / l)))));
	else
		tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (h / (l / (((M * D) / (d * 2.0)) ^ 2.0))))));
	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, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\right)\\

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


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

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

      \[\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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d

    1. Initial program 61.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. Simplified60.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u60.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 79.1% accurate, 0.3× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\ t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot t_1\right) \cdot \frac{h}{\ell}\right)\\ t_3 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\ \mathbf{if}\;t_2 \leq -4 \cdot 10^{-276}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left(t_3 \cdot \left(\frac{h}{\ell} \cdot t_3\right)\right)\right)\right)\\ \mathbf{elif}\;t_2 \leq 0 \lor \neg \left(t_2 \leq 5 \cdot 10^{+221}\right):\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{t_1}}\right)\right) \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\ \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)))
        (t_1 (pow (/ (* M D) (* d 2.0)) 2.0))
        (t_2
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (* 0.5 t_1) (/ h l)))))
        (t_3 (* D (* M (/ 0.5 d)))))
   (if (<= t_2 -4e-276)
     (* (sqrt (/ d h)) (* t_0 (- 1.0 (* 0.5 (* t_3 (* (/ h l) t_3))))))
     (if (or (<= t_2 0.0) (not (<= t_2 5e+221)))
       (fabs (/ d (sqrt (* h l))))
       (* (* t_0 (- 1.0 (* 0.5 (/ h (/ l t_1))))) (/ 1.0 (sqrt (/ h d))))))))
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 t_1 = pow(((M * D) / (d * 2.0)), 2.0);
	double t_2 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
	double t_3 = D * (M * (0.5 / d));
	double tmp;
	if (t_2 <= -4e-276) {
		tmp = sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (t_3 * ((h / l) * t_3)))));
	} else if ((t_2 <= 0.0) || !(t_2 <= 5e+221)) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / sqrt((h / d)));
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = sqrt((d / l))
    t_1 = ((m * d_1) / (d * 2.0d0)) ** 2.0d0
    t_2 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((0.5d0 * t_1) * (h / l)))
    t_3 = d_1 * (m * (0.5d0 / d))
    if (t_2 <= (-4d-276)) then
        tmp = sqrt((d / h)) * (t_0 * (1.0d0 - (0.5d0 * (t_3 * ((h / l) * t_3)))))
    else if ((t_2 <= 0.0d0) .or. (.not. (t_2 <= 5d+221))) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = (t_0 * (1.0d0 - (0.5d0 * (h / (l / t_1))))) * (1.0d0 / sqrt((h / d)))
    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 t_1 = Math.pow(((M * D) / (d * 2.0)), 2.0);
	double t_2 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
	double t_3 = D * (M * (0.5 / d));
	double tmp;
	if (t_2 <= -4e-276) {
		tmp = Math.sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (t_3 * ((h / l) * t_3)))));
	} else if ((t_2 <= 0.0) || !(t_2 <= 5e+221)) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / Math.sqrt((h / d)));
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = math.pow(((M * D) / (d * 2.0)), 2.0)
	t_2 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)))
	t_3 = D * (M * (0.5 / d))
	tmp = 0
	if t_2 <= -4e-276:
		tmp = math.sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (t_3 * ((h / l) * t_3)))))
	elif (t_2 <= 0.0) or not (t_2 <= 5e+221):
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / math.sqrt((h / d)))
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0
	t_2 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * t_1) * Float64(h / l))))
	t_3 = Float64(D * Float64(M * Float64(0.5 / d)))
	tmp = 0.0
	if (t_2 <= -4e-276)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(t_3 * Float64(Float64(h / l) * t_3))))));
	elseif ((t_2 <= 0.0) || !(t_2 <= 5e+221))
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / t_1))))) * Float64(1.0 / sqrt(Float64(h / d))));
	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));
	t_1 = ((M * D) / (d * 2.0)) ^ 2.0;
	t_2 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
	t_3 = D * (M * (0.5 / d));
	tmp = 0.0;
	if (t_2 <= -4e-276)
		tmp = sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (t_3 * ((h / l) * t_3)))));
	elseif ((t_2 <= 0.0) || ~((t_2 <= 5e+221)))
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / sqrt((h / d)));
	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]}, Block[{t$95$1 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = 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[(0.5 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-276], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(t$95$3 * N[(N[(h / l), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$2, 0.0], N[Not[LessEqual[t$95$2, 5e+221]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$0 * N[(1.0 - N[(0.5 * N[(h / N[(l / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot t_1\right) \cdot \frac{h}{\ell}\right)\\
t_3 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\
\mathbf{if}\;t_2 \leq -4 \cdot 10^{-276}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left(t_3 \cdot \left(\frac{h}{\ell} \cdot t_3\right)\right)\right)\right)\\

\mathbf{elif}\;t_2 \leq 0 \lor \neg \left(t_2 \leq 5 \cdot 10^{+221}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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)))) < -4e-276

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4e-276 < (*.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)))) < 0.0 or 5.0000000000000002e221 < (*.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 20.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. Taylor expanded in d around inf 29.6%

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.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)))) < 5.0000000000000002e221

    1. Initial program 99.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. Simplified99.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 78.5% accurate, 0.3× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\ t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot t_1\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t_2 \leq -4 \cdot 10^{-276}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;t_2 \leq 0 \lor \neg \left(t_2 \leq 5 \cdot 10^{+221}\right):\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{t_1}}\right)\right) \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\ \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)))
        (t_1 (pow (/ (* M D) (* d 2.0)) 2.0))
        (t_2
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (* 0.5 t_1) (/ h l))))))
   (if (<= t_2 -4e-276)
     (*
      (sqrt (/ d h))
      (*
       t_0
       (- 1.0 (* 0.5 (pow (* (* M (* 0.5 (/ D d))) (sqrt (/ h l))) 2.0)))))
     (if (or (<= t_2 0.0) (not (<= t_2 5e+221)))
       (fabs (/ d (sqrt (* h l))))
       (* (* t_0 (- 1.0 (* 0.5 (/ h (/ l t_1))))) (/ 1.0 (sqrt (/ h d))))))))
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 t_1 = pow(((M * D) / (d * 2.0)), 2.0);
	double t_2 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
	double tmp;
	if (t_2 <= -4e-276) {
		tmp = sqrt((d / h)) * (t_0 * (1.0 - (0.5 * pow(((M * (0.5 * (D / d))) * sqrt((h / l))), 2.0))));
	} else if ((t_2 <= 0.0) || !(t_2 <= 5e+221)) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / sqrt((h / d)));
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = sqrt((d / l))
    t_1 = ((m * d_1) / (d * 2.0d0)) ** 2.0d0
    t_2 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((0.5d0 * t_1) * (h / l)))
    if (t_2 <= (-4d-276)) then
        tmp = sqrt((d / h)) * (t_0 * (1.0d0 - (0.5d0 * (((m * (0.5d0 * (d_1 / d))) * sqrt((h / l))) ** 2.0d0))))
    else if ((t_2 <= 0.0d0) .or. (.not. (t_2 <= 5d+221))) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = (t_0 * (1.0d0 - (0.5d0 * (h / (l / t_1))))) * (1.0d0 / sqrt((h / d)))
    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 t_1 = Math.pow(((M * D) / (d * 2.0)), 2.0);
	double t_2 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
	double tmp;
	if (t_2 <= -4e-276) {
		tmp = Math.sqrt((d / h)) * (t_0 * (1.0 - (0.5 * Math.pow(((M * (0.5 * (D / d))) * Math.sqrt((h / l))), 2.0))));
	} else if ((t_2 <= 0.0) || !(t_2 <= 5e+221)) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / Math.sqrt((h / d)));
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = math.pow(((M * D) / (d * 2.0)), 2.0)
	t_2 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)))
	tmp = 0
	if t_2 <= -4e-276:
		tmp = math.sqrt((d / h)) * (t_0 * (1.0 - (0.5 * math.pow(((M * (0.5 * (D / d))) * math.sqrt((h / l))), 2.0))))
	elif (t_2 <= 0.0) or not (t_2 <= 5e+221):
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / math.sqrt((h / d)))
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0
	t_2 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * t_1) * Float64(h / l))))
	tmp = 0.0
	if (t_2 <= -4e-276)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(M * Float64(0.5 * Float64(D / d))) * sqrt(Float64(h / l))) ^ 2.0)))));
	elseif ((t_2 <= 0.0) || !(t_2 <= 5e+221))
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / t_1))))) * Float64(1.0 / sqrt(Float64(h / d))));
	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));
	t_1 = ((M * D) / (d * 2.0)) ^ 2.0;
	t_2 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
	tmp = 0.0;
	if (t_2 <= -4e-276)
		tmp = sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (((M * (0.5 * (D / d))) * sqrt((h / l))) ^ 2.0))));
	elseif ((t_2 <= 0.0) || ~((t_2 <= 5e+221)))
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / sqrt((h / d)));
	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]}, Block[{t$95$1 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = 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[(0.5 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-276], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$2, 0.0], N[Not[LessEqual[t$95$2, 5e+221]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$0 * N[(1.0 - N[(0.5 * N[(h / N[(l / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot t_1\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t_2 \leq -4 \cdot 10^{-276}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\

\mathbf{elif}\;t_2 \leq 0 \lor \neg \left(t_2 \leq 5 \cdot 10^{+221}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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)))) < -4e-276

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

    if -4e-276 < (*.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)))) < 0.0 or 5.0000000000000002e221 < (*.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 20.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. Taylor expanded in d around inf 29.6%

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.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)))) < 5.0000000000000002e221

    1. Initial program 99.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. Simplified99.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 77.0% accurate, 0.8× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := 1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\\ \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\ \mathbf{elif}\;h \leq 2.6 \cdot 10^{+189}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_0\right) \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_0\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 (- 1.0 (* 0.5 (/ h (/ l (pow (/ (* M D) (* d 2.0)) 2.0)))))))
   (if (<= h -5e-310)
     (*
      (sqrt (/ d h))
      (*
       (- 1.0 (* 0.5 (* h (/ (pow (* M (* 0.5 (/ D d))) 2.0) l))))
       (/ (sqrt (- d)) (sqrt (- l)))))
     (if (<= h 2.6e+189)
       (* (* (/ (sqrt d) (sqrt l)) t_0) (/ 1.0 (sqrt (/ h d))))
       (* (/ (sqrt d) (sqrt h)) (* (sqrt (/ d l)) t_0))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (0.5 * (h / (l / pow(((M * D) / (d * 2.0)), 2.0))));
	double tmp;
	if (h <= -5e-310) {
		tmp = sqrt((d / h)) * ((1.0 - (0.5 * (h * (pow((M * (0.5 * (D / d))), 2.0) / l)))) * (sqrt(-d) / sqrt(-l)));
	} else if (h <= 2.6e+189) {
		tmp = ((sqrt(d) / sqrt(l)) * t_0) * (1.0 / sqrt((h / d)));
	} else {
		tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0);
	}
	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 = 1.0d0 - (0.5d0 * (h / (l / (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
    if (h <= (-5d-310)) then
        tmp = sqrt((d / h)) * ((1.0d0 - (0.5d0 * (h * (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) / l)))) * (sqrt(-d) / sqrt(-l)))
    else if (h <= 2.6d+189) then
        tmp = ((sqrt(d) / sqrt(l)) * t_0) * (1.0d0 / sqrt((h / d)))
    else
        tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0)
    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 = 1.0 - (0.5 * (h / (l / Math.pow(((M * D) / (d * 2.0)), 2.0))));
	double tmp;
	if (h <= -5e-310) {
		tmp = Math.sqrt((d / h)) * ((1.0 - (0.5 * (h * (Math.pow((M * (0.5 * (D / d))), 2.0) / l)))) * (Math.sqrt(-d) / Math.sqrt(-l)));
	} else if (h <= 2.6e+189) {
		tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_0) * (1.0 / Math.sqrt((h / d)));
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * t_0);
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = 1.0 - (0.5 * (h / (l / math.pow(((M * D) / (d * 2.0)), 2.0))))
	tmp = 0
	if h <= -5e-310:
		tmp = math.sqrt((d / h)) * ((1.0 - (0.5 * (h * (math.pow((M * (0.5 * (D / d))), 2.0) / l)))) * (math.sqrt(-d) / math.sqrt(-l)))
	elif h <= 2.6e+189:
		tmp = ((math.sqrt(d) / math.sqrt(l)) * t_0) * (1.0 / math.sqrt((h / d)))
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * t_0)
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))
	tmp = 0.0
	if (h <= -5e-310)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) / l)))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))));
	elseif (h <= 2.6e+189)
		tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_0) * Float64(1.0 / sqrt(Float64(h / d))));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * t_0));
	end
	return tmp
end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = 1.0 - (0.5 * (h / (l / (((M * D) / (d * 2.0)) ^ 2.0))));
	tmp = 0.0;
	if (h <= -5e-310)
		tmp = sqrt((d / h)) * ((1.0 - (0.5 * (h * (((M * (0.5 * (D / d))) ^ 2.0) / l)))) * (sqrt(-d) / sqrt(-l)));
	elseif (h <= 2.6e+189)
		tmp = ((sqrt(d) / sqrt(l)) * t_0) * (1.0 / sqrt((h / d)));
	else
		tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0);
	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[(1.0 - N[(0.5 * N[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.6e+189], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\

\mathbf{elif}\;h \leq 2.6 \cdot 10^{+189}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_0\right) \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\

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


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

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

      \[\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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h < 2.59999999999999981e189

    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. Simplified66.2%

      \[\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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u65.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.59999999999999981e189 < h

    1. Initial program 38.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. Simplified38.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u38.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 76.9% accurate, 0.8× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := 1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\\ t_1 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;t_1 \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\ \mathbf{elif}\;h \leq 2.4 \cdot 10^{+189}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_0\right) \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_0\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 (- 1.0 (* 0.5 (/ h (/ l (pow (/ (* M D) (* d 2.0)) 2.0))))))
        (t_1 (sqrt (/ d h))))
   (if (<= h -5e-310)
     (*
      t_1
      (*
       (- 1.0 (* 0.5 (* h (/ (pow (* M (* 0.5 (/ D d))) 2.0) l))))
       (/ (sqrt (- d)) (sqrt (- l)))))
     (if (<= h 2.4e+189)
       (* (* (/ (sqrt d) (sqrt l)) t_0) t_1)
       (* (/ (sqrt d) (sqrt h)) (* (sqrt (/ d l)) t_0))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (0.5 * (h / (l / pow(((M * D) / (d * 2.0)), 2.0))));
	double t_1 = sqrt((d / h));
	double tmp;
	if (h <= -5e-310) {
		tmp = t_1 * ((1.0 - (0.5 * (h * (pow((M * (0.5 * (D / d))), 2.0) / l)))) * (sqrt(-d) / sqrt(-l)));
	} else if (h <= 2.4e+189) {
		tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_1;
	} else {
		tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0);
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (0.5d0 * (h / (l / (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
    t_1 = sqrt((d / h))
    if (h <= (-5d-310)) then
        tmp = t_1 * ((1.0d0 - (0.5d0 * (h * (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) / l)))) * (sqrt(-d) / sqrt(-l)))
    else if (h <= 2.4d+189) then
        tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_1
    else
        tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0)
    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 = 1.0 - (0.5 * (h / (l / Math.pow(((M * D) / (d * 2.0)), 2.0))));
	double t_1 = Math.sqrt((d / h));
	double tmp;
	if (h <= -5e-310) {
		tmp = t_1 * ((1.0 - (0.5 * (h * (Math.pow((M * (0.5 * (D / d))), 2.0) / l)))) * (Math.sqrt(-d) / Math.sqrt(-l)));
	} else if (h <= 2.4e+189) {
		tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_0) * t_1;
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * t_0);
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = 1.0 - (0.5 * (h / (l / math.pow(((M * D) / (d * 2.0)), 2.0))))
	t_1 = math.sqrt((d / h))
	tmp = 0
	if h <= -5e-310:
		tmp = t_1 * ((1.0 - (0.5 * (h * (math.pow((M * (0.5 * (D / d))), 2.0) / l)))) * (math.sqrt(-d) / math.sqrt(-l)))
	elif h <= 2.4e+189:
		tmp = ((math.sqrt(d) / math.sqrt(l)) * t_0) * t_1
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * t_0)
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))
	t_1 = sqrt(Float64(d / h))
	tmp = 0.0
	if (h <= -5e-310)
		tmp = Float64(t_1 * Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) / l)))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))));
	elseif (h <= 2.4e+189)
		tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_0) * t_1);
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * t_0));
	end
	return tmp
end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = 1.0 - (0.5 * (h / (l / (((M * D) / (d * 2.0)) ^ 2.0))));
	t_1 = sqrt((d / h));
	tmp = 0.0;
	if (h <= -5e-310)
		tmp = t_1 * ((1.0 - (0.5 * (h * (((M * (0.5 * (D / d))) ^ 2.0) / l)))) * (sqrt(-d) / sqrt(-l)));
	elseif (h <= 2.4e+189)
		tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_1;
	else
		tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0);
	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[(1.0 - N[(0.5 * N[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(t$95$1 * N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.4e+189], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\

\mathbf{elif}\;h \leq 2.4 \cdot 10^{+189}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_0\right) \cdot t_1\\

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


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

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

      \[\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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h < 2.4000000000000001e189

    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. Simplified66.2%

      \[\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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u65.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.4000000000000001e189 < h

    1. Initial program 38.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. Simplified38.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u38.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 78.9% 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}\;\ell \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 5.4 \cdot 10^{-191}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{d}{D} \cdot \left(\frac{2}{M} \cdot \frac{\ell}{\frac{D}{d} \cdot \left(0.5 \cdot M\right)}\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\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 (<= l -1e-310)
     (*
      (/ (sqrt (- d)) (sqrt (- h)))
      (* t_0 (- 1.0 (* 0.5 (* h (/ (pow (* M (* 0.5 (/ D d))) 2.0) l))))))
     (if (<= l 5.4e-191)
       (*
        (sqrt (/ d h))
        (*
         (/ (sqrt d) (sqrt l))
         (-
          1.0
          (*
           0.5
           (/ h (* (/ d D) (* (/ 2.0 M) (/ l (* (/ D d) (* 0.5 M))))))))))
       (*
        (/ (sqrt d) (sqrt h))
        (*
         t_0
         (- 1.0 (* 0.5 (/ h (/ l (pow (/ (* M D) (* d 2.0)) 2.0)))))))))))
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 <= -1e-310) {
		tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 - (0.5 * (h * (pow((M * (0.5 * (D / d))), 2.0) / l)))));
	} else if (l <= 5.4e-191) {
		tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (h / ((d / D) * ((2.0 / M) * (l / ((D / d) * (0.5 * M)))))))));
	} else {
		tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * (h / (l / pow(((M * D) / (d * 2.0)), 2.0))))));
	}
	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 <= (-1d-310)) then
        tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0d0 - (0.5d0 * (h * (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) / l)))))
    else if (l <= 5.4d-191) then
        tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * (h / ((d / d_1) * ((2.0d0 / m) * (l / ((d_1 / d) * (0.5d0 * m)))))))))
    else
        tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 - (0.5d0 * (h / (l / (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))))
    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 <= -1e-310) {
		tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * (1.0 - (0.5 * (h * (Math.pow((M * (0.5 * (D / d))), 2.0) / l)))));
	} else if (l <= 5.4e-191) {
		tmp = Math.sqrt((d / h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (h / ((d / D) * ((2.0 / M) * (l / ((D / d) * (0.5 * M)))))))));
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 - (0.5 * (h / (l / Math.pow(((M * D) / (d * 2.0)), 2.0))))));
	}
	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 <= -1e-310:
		tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * (1.0 - (0.5 * (h * (math.pow((M * (0.5 * (D / d))), 2.0) / l)))))
	elif l <= 5.4e-191:
		tmp = math.sqrt((d / h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (h / ((d / D) * ((2.0 / M) * (l / ((D / d) * (0.5 * M)))))))))
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 - (0.5 * (h / (l / math.pow(((M * D) / (d * 2.0)), 2.0))))))
	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 <= -1e-310)
		tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) / l))))));
	elseif (l <= 5.4e-191)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(h / Float64(Float64(d / D) * Float64(Float64(2.0 / M) * Float64(l / Float64(Float64(D / d) * Float64(0.5 * M))))))))));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))));
	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 <= -1e-310)
		tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 - (0.5 * (h * (((M * (0.5 * (D / d))) ^ 2.0) / l)))));
	elseif (l <= 5.4e-191)
		tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (h / ((d / D) * ((2.0 / M) * (l / ((D / d) * (0.5 * M)))))))));
	else
		tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * (h / (l / (((M * D) / (d * 2.0)) ^ 2.0))))));
	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, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e-191], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h / N[(N[(d / D), $MachinePrecision] * N[(N[(2.0 / M), $MachinePrecision] * N[(l / N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $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}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\right)\\

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

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


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

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

      \[\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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l < 5.39999999999999998e-191

    1. Initial program 62.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. Simplified62.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u62.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.39999999999999998e-191 < l

    1. Initial program 61.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. Simplified60.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u59.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 66.1% accurate, 1.0× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;D \leq 0.235:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}^{2}}}\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
 (if (<= D 0.235)
   (fabs (/ d (sqrt (* h l))))
   (*
    (sqrt (/ d h))
    (*
     (sqrt (/ d l))
     (- 1.0 (* 0.5 (/ h (/ l (pow (* (* M D) (/ 0.5 d)) 2.0)))))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (D <= 0.235) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (h / (l / pow(((M * D) * (0.5 / d)), 2.0))))));
	}
	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 <= 0.235d0) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (h / (l / (((m * d_1) * (0.5d0 / d)) ** 2.0d0))))))
    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 <= 0.235) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (h / (l / Math.pow(((M * D) * (0.5 / d)), 2.0))))));
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if D <= 0.235:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (h / (l / math.pow(((M * D) * (0.5 / d)), 2.0))))))
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (D <= 0.235)
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) * Float64(0.5 / d)) ^ 2.0)))))));
	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 <= 0.235)
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (h / (l / (((M * D) * (0.5 / d)) ^ 2.0))))));
	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, 0.235], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 0.235:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

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


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

    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. Taylor expanded in d around inf 27.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt24.6%

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

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

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

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

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

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

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

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

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

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

    if 0.23499999999999999 < D

    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. Simplified52.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u51.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 66.7% accurate, 1.4× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;D \leq 0.46:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{\frac{D}{d} \cdot \left(0.5 \cdot M\right)} \cdot \left(\frac{d}{D} \cdot \frac{2}{M}\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
 (if (<= D 0.46)
   (fabs (/ d (sqrt (* h l))))
   (*
    (/ 1.0 (sqrt (/ h d)))
    (*
     (sqrt (/ d l))
     (-
      1.0
      (* 0.5 (/ h (* (/ l (* (/ D d) (* 0.5 M))) (* (/ d D) (/ 2.0 M))))))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (D <= 0.46) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = (1.0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0 - (0.5 * (h / ((l / ((D / d) * (0.5 * M))) * ((d / D) * (2.0 / M)))))));
	}
	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 <= 0.46d0) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = (1.0d0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (h / ((l / ((d_1 / d) * (0.5d0 * m))) * ((d / d_1) * (2.0d0 / m)))))))
    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 <= 0.46) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = (1.0 / Math.sqrt((h / d))) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (h / ((l / ((D / d) * (0.5 * M))) * ((d / D) * (2.0 / M)))))));
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if D <= 0.46:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = (1.0 / math.sqrt((h / d))) * (math.sqrt((d / l)) * (1.0 - (0.5 * (h / ((l / ((D / d) * (0.5 * M))) * ((d / D) * (2.0 / M)))))))
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (D <= 0.46)
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(Float64(1.0 / sqrt(Float64(h / d))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(h / Float64(Float64(l / Float64(Float64(D / d) * Float64(0.5 * M))) * Float64(Float64(d / D) * Float64(2.0 / M))))))));
	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 <= 0.46)
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = (1.0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0 - (0.5 * (h / ((l / ((D / d) * (0.5 * M))) * ((d / D) * (2.0 / M)))))));
	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, 0.46], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h / N[(N[(l / N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 0.46:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

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


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

    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. Taylor expanded in d around inf 27.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt24.6%

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

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

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

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

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

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

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

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

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

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

    if 0.46000000000000002 < D

    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. Simplified52.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u51.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 67.0% accurate, 1.4× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\ \mathbf{if}\;D \leq 0.215:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(t_0 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\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 (* D (* M (/ 0.5 d)))))
   (if (<= D 0.215)
     (fabs (/ d (sqrt (* h l))))
     (*
      (sqrt (/ d h))
      (* (sqrt (/ d l)) (- 1.0 (* 0.5 (* t_0 (* (/ h l) t_0)))))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = D * (M * (0.5 / d));
	double tmp;
	if (D <= 0.215) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_0 * ((h / l) * t_0)))));
	}
	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_1 * (m * (0.5d0 / d))
    if (d_1 <= 0.215d0) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (t_0 * ((h / l) * t_0)))))
    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 = D * (M * (0.5 / d));
	double tmp;
	if (D <= 0.215) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (t_0 * ((h / l) * t_0)))));
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = D * (M * (0.5 / d))
	tmp = 0
	if D <= 0.215:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (t_0 * ((h / l) * t_0)))))
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(D * Float64(M * Float64(0.5 / d)))
	tmp = 0.0
	if (D <= 0.215)
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(t_0 * Float64(Float64(h / l) * t_0))))));
	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 * (M * (0.5 / d));
	tmp = 0.0;
	if (D <= 0.215)
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_0 * ((h / l) * t_0)))));
	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[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 0.215], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\
\mathbf{if}\;D \leq 0.215:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

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


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

    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. Taylor expanded in d around inf 27.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt24.6%

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

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

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

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

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

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

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

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

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

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

    if 0.214999999999999997 < D

    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. Simplified52.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)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u51.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 44.0% accurate, 1.6× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq 1.9 \cdot 10^{+70}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\frac{1}{{\left(h \cdot \ell\right)}^{3}}\right)}^{0.16666666666666666}\\ \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 (<= M 1.9e+70)
   (fabs (/ d (sqrt (* h l))))
   (* d (pow (/ 1.0 (pow (* h l) 3.0)) 0.16666666666666666))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 1.9e+70) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = d * pow((1.0 / pow((h * l), 3.0)), 0.16666666666666666);
	}
	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 (m <= 1.9d+70) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = d * ((1.0d0 / ((h * l) ** 3.0d0)) ** 0.16666666666666666d0)
    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 (M <= 1.9e+70) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = d * Math.pow((1.0 / Math.pow((h * l), 3.0)), 0.16666666666666666);
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if M <= 1.9e+70:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = d * math.pow((1.0 / math.pow((h * l), 3.0)), 0.16666666666666666)
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (M <= 1.9e+70)
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(d * (Float64(1.0 / (Float64(h * l) ^ 3.0)) ^ 0.16666666666666666));
	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 (M <= 1.9e+70)
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = d * ((1.0 / ((h * l) ^ 3.0)) ^ 0.16666666666666666);
	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[M, 1.9e+70], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Power[N[(1.0 / N[Power[N[(h * l), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], 0.16666666666666666], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.9 \cdot 10^{+70}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\frac{1}{{\left(h \cdot \ell\right)}^{3}}\right)}^{0.16666666666666666}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 1.8999999999999999e70

    1. Initial program 61.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. Taylor expanded in d around inf 28.0%

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

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

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

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

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

        \[\leadsto \sqrt{{\left(d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}}\right)}^{2}} \]
      6. un-div-inv37.9%

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

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

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

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

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

    if 1.8999999999999999e70 < M

    1. Initial program 65.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf 16.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto d \cdot \color{blue}{{\left(\frac{1}{{\left(h \cdot \ell\right)}^{3}}\right)}^{0.16666666666666666}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 1.9 \cdot 10^{+70}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\frac{1}{{\left(h \cdot \ell\right)}^{3}}\right)}^{0.16666666666666666}\\ \end{array} \]

Alternative 11: 44.6% accurate, 1.6× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq 6.2 \cdot 10^{+26}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{e^{0.5 \cdot \mathsf{log1p}\left(h \cdot \ell + -1\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 (<= M 6.2e+26)
   (fabs (/ d (sqrt (* h l))))
   (/ d (exp (* 0.5 (log1p (+ (* h l) -1.0)))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 6.2e+26) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = d / exp((0.5 * log1p(((h * l) + -1.0))));
	}
	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 (M <= 6.2e+26) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = d / Math.exp((0.5 * Math.log1p(((h * l) + -1.0))));
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if M <= 6.2e+26:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = d / math.exp((0.5 * math.log1p(((h * l) + -1.0))))
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (M <= 6.2e+26)
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(d / exp(Float64(0.5 * log1p(Float64(Float64(h * l) + -1.0)))));
	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[M, 6.2e+26], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Exp[N[(0.5 * N[Log[1 + N[(N[(h * l), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 6.2 \cdot 10^{+26}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{e^{0.5 \cdot \mathsf{log1p}\left(h \cdot \ell + -1\right)}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 6.1999999999999999e26

    1. Initial program 60.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. Taylor expanded in d around inf 28.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt25.4%

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

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

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

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

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

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

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

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

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

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

    if 6.1999999999999999e26 < M

    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. Taylor expanded in d around inf 16.7%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
      2. expm1-udef7.3%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      5. un-div-inv8.2%

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h \cdot \ell}}\right)\right)} \]
      2. expm1-log1p17.7%

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

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

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

        \[\leadsto \frac{d}{\color{blue}{e^{\log \left(h \cdot \ell\right) \cdot 0.5}}} \]
    8. Applied egg-rr16.7%

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

        \[\leadsto \frac{d}{e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(h \cdot \ell\right)\right)\right)} \cdot 0.5}} \]
      2. expm1-udef20.2%

        \[\leadsto \frac{d}{e^{\mathsf{log1p}\left(\color{blue}{e^{\log \left(h \cdot \ell\right)} - 1}\right) \cdot 0.5}} \]
      3. add-exp-log20.2%

        \[\leadsto \frac{d}{e^{\mathsf{log1p}\left(\color{blue}{h \cdot \ell} - 1\right) \cdot 0.5}} \]
    10. Applied egg-rr20.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 6.2 \cdot 10^{+26}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{e^{0.5 \cdot \mathsf{log1p}\left(h \cdot \ell + -1\right)}}\\ \end{array} \]

Alternative 12: 46.6% 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}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\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 (<= h -5e-310)
   (fabs (/ d (sqrt (* h l))))
   (* d (* (pow l -0.5) (pow h -0.5)))))
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 = fabs((d / sqrt((h * l))));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	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 = abs((d / sqrt((h * l))))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    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 = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if h <= -5e-310:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	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 = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	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 = abs((d / sqrt((h * l))));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	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[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

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


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

    1. Initial program 62.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. Taylor expanded in d around inf 7.9%

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

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

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

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

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

        \[\leadsto \sqrt{{\left(d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}}\right)}^{2}} \]
      6. un-div-inv35.5%

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

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

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

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

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

    if -4.999999999999985e-310 < h

    1. Initial program 61.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. Taylor expanded in d around inf 46.8%

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      5. un-div-inv32.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{h \cdot \ell}}}\right)} - 1 \]
    4. Applied egg-rr32.3%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h \cdot \ell}}\right)\right)} \]
      2. expm1-log1p47.5%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{h \cdot \ell}} \cdot d} \]
      3. pow1/247.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 13: 43.5% accurate, 1.6× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{if}\;M \leq 2.6 \cdot 10^{+70}:\\ \;\;\;\;\left|t_0\right|\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \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 (/ d (sqrt (* h l))))) (if (<= M 2.6e+70) (fabs t_0) t_0)))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = d / sqrt((h * l));
	double tmp;
	if (M <= 2.6e+70) {
		tmp = fabs(t_0);
	} else {
		tmp = t_0;
	}
	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 / sqrt((h * l))
    if (m <= 2.6d+70) then
        tmp = abs(t_0)
    else
        tmp = t_0
    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 = d / Math.sqrt((h * l));
	double tmp;
	if (M <= 2.6e+70) {
		tmp = Math.abs(t_0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = d / math.sqrt((h * l))
	tmp = 0
	if M <= 2.6e+70:
		tmp = math.fabs(t_0)
	else:
		tmp = t_0
	return tmp
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(d / sqrt(Float64(h * l)))
	tmp = 0.0
	if (M <= 2.6e+70)
		tmp = abs(t_0);
	else
		tmp = t_0;
	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 / sqrt((h * l));
	tmp = 0.0;
	if (M <= 2.6e+70)
		tmp = abs(t_0);
	else
		tmp = t_0;
	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[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 2.6e+70], N[Abs[t$95$0], $MachinePrecision], t$95$0]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;M \leq 2.6 \cdot 10^{+70}:\\
\;\;\;\;\left|t_0\right|\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 2.6e70

    1. Initial program 61.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. Taylor expanded in d around inf 28.0%

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

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

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

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

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

        \[\leadsto \sqrt{{\left(d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}}\right)}^{2}} \]
      6. un-div-inv37.9%

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

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

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

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

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

    if 2.6e70 < M

    1. Initial program 65.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf 16.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. expm1-log1p-u10.8%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      5. un-div-inv8.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{h \cdot \ell}}}\right)} - 1 \]
    4. Applied egg-rr8.0%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h \cdot \ell}}\right)\right)} \]
      2. expm1-log1p17.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 2.6 \cdot 10^{+70}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \]

Alternative 14: 46.7% 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}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \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) (fabs (/ 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 = fabs((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 = abs((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 = Math.abs((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 = math.fabs((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 = abs(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 = abs((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[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

\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 62.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. Taylor expanded in d around inf 7.9%

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

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

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

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

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

        \[\leadsto \sqrt{{\left(d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}}\right)}^{2}} \]
      6. un-div-inv35.5%

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

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

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

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

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

    if -4.999999999999985e-310 < h

    1. Initial program 61.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. Taylor expanded in d around inf 46.8%

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      5. un-div-inv32.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{h \cdot \ell}}}\right)} - 1 \]
    4. Applied egg-rr32.3%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h \cdot \ell}}\right)\right)} \]
      2. expm1-log1p47.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]

Alternative 15: 27.1% accurate, 3.1× speedup?

\[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ d \cdot {\left(h \cdot \ell\right)}^{-0.5} \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 (pow (* h l) -0.5)))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	return d * pow((h * l), -0.5);
}
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 * ((h * l) ** (-0.5d0))
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.pow((h * l), -0.5);
}
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	return d * math.pow((h * l), -0.5)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	return Float64(d * (Float64(h * l) ^ -0.5))
end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
	tmp = d * ((h * l) ^ -0.5);
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[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 62.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. Taylor expanded in d around inf 25.7%

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

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

      \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{1}{h \cdot \ell}}\right)} - 1\right)} \]
    3. inv-pow17.2%

      \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right)} - 1\right) \]
    4. sqrt-pow117.5%

      \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right)} - 1\right) \]
    5. metadata-eval17.5%

      \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right)} - 1\right) \]
  4. Applied egg-rr17.5%

    \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{-0.5}\right)} - 1\right)} \]
  5. Step-by-step derivation
    1. expm1-def25.6%

      \[\leadsto d \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{-0.5}\right)\right)} \]
    2. expm1-log1p26.0%

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

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

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

Alternative 16: 27.1% 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 62.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. Taylor expanded in d around inf 25.7%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  3. Step-by-step derivation
    1. expm1-log1p-u22.2%

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

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

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

      \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
    5. un-div-inv16.2%

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

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h \cdot \ell}}\right)\right)} \]
    2. expm1-log1p26.0%

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

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  7. Final simplification26.0%

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

Reproduce

?
herbie shell --seed 2023310 
(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)))))