Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.5% → 83.4%
Time: 17.3s
Alternatives: 19
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 19 alternatives:

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

Initial Program: 66.5% accurate, 1.0× speedup?

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

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

Alternative 1: 83.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{-d}\\ t_1 := \frac{M}{\frac{d}{D}}\\ \mathbf{if}\;d \leq -4 \cdot 10^{-311}:\\ \;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (- d))) (t_1 (/ M (/ d D))))
   (if (<= d -4e-311)
     (*
      (/ t_0 (sqrt (- h)))
      (*
       (/ t_0 (sqrt (- l)))
       (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D d)) 2.0) l))))))
     (*
      (/ (sqrt d) (sqrt h))
      (* (/ 1.0 (sqrt (/ l d))) (- 1.0 (* h (* 0.125 (* t_1 (/ t_1 l))))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(-d);
	double t_1 = M / (d / D);
	double tmp;
	if (d <= -4e-311) {
		tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0 - (h * (0.125 * (pow((M * (D / d)), 2.0) / l)))));
	} else {
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 / sqrt((l / d))) * (1.0 - (h * (0.125 * (t_1 * (t_1 / l))))));
	}
	return tmp;
}
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 = sqrt(-d)
    t_1 = m / (d / d_1)
    if (d <= (-4d-311)) then
        tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0d0 - (h * (0.125d0 * (((m * (d_1 / d)) ** 2.0d0) / l)))))
    else
        tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 / sqrt((l / d))) * (1.0d0 - (h * (0.125d0 * (t_1 * (t_1 / l))))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt(-d);
	double t_1 = M / (d / D);
	double tmp;
	if (d <= -4e-311) {
		tmp = (t_0 / Math.sqrt(-h)) * ((t_0 / Math.sqrt(-l)) * (1.0 - (h * (0.125 * (Math.pow((M * (D / d)), 2.0) / l)))));
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 / Math.sqrt((l / d))) * (1.0 - (h * (0.125 * (t_1 * (t_1 / l))))));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt(-d)
	t_1 = M / (d / D)
	tmp = 0
	if d <= -4e-311:
		tmp = (t_0 / math.sqrt(-h)) * ((t_0 / math.sqrt(-l)) * (1.0 - (h * (0.125 * (math.pow((M * (D / d)), 2.0) / l)))))
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 / math.sqrt((l / d))) * (1.0 - (h * (0.125 * (t_1 * (t_1 / l))))))
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(-d))
	t_1 = Float64(M / Float64(d / D))
	tmp = 0.0
	if (d <= -4e-311)
		tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D / d)) ^ 2.0) / l))))));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_1 * Float64(t_1 / l)))))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt(-d);
	t_1 = M / (d / D);
	tmp = 0.0;
	if (d <= -4e-311)
		tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0 - (h * (0.125 * (((M * (D / d)) ^ 2.0) / l)))));
	else
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 / sqrt((l / d))) * (1.0 - (h * (0.125 * (t_1 * (t_1 / l))))));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4e-311], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M * N[(D / d), $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[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(0.125 * N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := \frac{M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -4 \cdot 10^{-311}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)\right)\\

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999979e-311 < d

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 78.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{M}{\frac{d}{D}}\\ t_1 := \sqrt{-d}\\ \mathbf{if}\;d \leq -1.42 \cdot 10^{-95}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-311}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{t\_1}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ M (/ d D))) (t_1 (sqrt (- d))))
   (if (<= d -1.42e-95)
     (*
      (sqrt (/ d h))
      (*
       (/ t_1 (sqrt (- l)))
       (+ 1.0 (* h (/ (* -0.125 (pow (* D (/ M d)) 2.0)) l)))))
     (if (<= d -4e-311)
       (*
        (sqrt (/ d l))
        (*
         (/ t_1 (sqrt (- h)))
         (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M 2.0) d)) 2.0) -0.5)))))
       (*
        (/ (sqrt d) (sqrt h))
        (*
         (/ 1.0 (sqrt (/ l d)))
         (- 1.0 (* h (* 0.125 (* t_0 (/ t_0 l)))))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	double t_1 = sqrt(-d);
	double tmp;
	if (d <= -1.42e-95) {
		tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0 + (h * ((-0.125 * pow((D * (M / d)), 2.0)) / l))));
	} else if (d <= -4e-311) {
		tmp = sqrt((d / l)) * ((t_1 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D * ((M / 2.0) / d)), 2.0) * -0.5))));
	} else {
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 / sqrt((l / d))) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))));
	}
	return tmp;
}
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 = m / (d / d_1)
    t_1 = sqrt(-d)
    if (d <= (-1.42d-95)) then
        tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0d0 + (h * (((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)) / l))))
    else if (d <= (-4d-311)) then
        tmp = sqrt((d / l)) * ((t_1 / sqrt(-h)) * (1.0d0 + ((h / l) * (((d_1 * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
    else
        tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 / sqrt((l / d))) * (1.0d0 - (h * (0.125d0 * (t_0 * (t_0 / l))))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	double t_1 = Math.sqrt(-d);
	double tmp;
	if (d <= -1.42e-95) {
		tmp = Math.sqrt((d / h)) * ((t_1 / Math.sqrt(-l)) * (1.0 + (h * ((-0.125 * Math.pow((D * (M / d)), 2.0)) / l))));
	} else if (d <= -4e-311) {
		tmp = Math.sqrt((d / l)) * ((t_1 / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D * ((M / 2.0) / d)), 2.0) * -0.5))));
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 / Math.sqrt((l / d))) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = M / (d / D)
	t_1 = math.sqrt(-d)
	tmp = 0
	if d <= -1.42e-95:
		tmp = math.sqrt((d / h)) * ((t_1 / math.sqrt(-l)) * (1.0 + (h * ((-0.125 * math.pow((D * (M / d)), 2.0)) / l))))
	elif d <= -4e-311:
		tmp = math.sqrt((d / l)) * ((t_1 / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow((D * ((M / 2.0) / d)), 2.0) * -0.5))))
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 / math.sqrt((l / d))) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))))
	return tmp
function code(d, h, l, M, D)
	t_0 = Float64(M / Float64(d / D))
	t_1 = sqrt(Float64(-d))
	tmp = 0.0
	if (d <= -1.42e-95)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)) / l)))));
	elseif (d <= -4e-311)
		tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5)))));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 * Float64(t_0 / l)))))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = M / (d / D);
	t_1 = sqrt(-d);
	tmp = 0.0;
	if (d <= -1.42e-95)
		tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0 + (h * ((-0.125 * ((D * (M / d)) ^ 2.0)) / l))));
	elseif (d <= -4e-311)
		tmp = sqrt((d / l)) * ((t_1 / sqrt(-h)) * (1.0 + ((h / l) * (((D * ((M / 2.0) / d)) ^ 2.0) * -0.5))));
	else
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 / sqrt((l / d))) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -1.42e-95], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-311], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{M}{\frac{d}{D}}\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;d \leq -1.42 \cdot 10^{-95}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)\right)\\

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(\left(-1 + e^{\color{blue}{\log \left(1 + \left(\left(-h\right) \cdot 0.125\right) \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}}\right) + 1\right)\right) \]
      5. rem-exp-log92.9%

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

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

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

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

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

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

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

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

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

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

    if -1.42000000000000007e-95 < d < -3.99999999999979e-311

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

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

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

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

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

    if -3.99999999999979e-311 < d

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 79.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{-d}\\ t_1 := \frac{M}{\frac{d}{D}}\\ t_2 := 1 - h \cdot \left(0.125 \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\\ \mathbf{if}\;h \leq -1.7 \cdot 10^{+75}:\\ \;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\left(1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{elif}\;h \leq -1 \cdot 10^{-311}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot t\_2\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot t\_2\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (- d)))
        (t_1 (/ M (/ d D)))
        (t_2 (- 1.0 (* h (* 0.125 (* t_1 (/ t_1 l)))))))
   (if (<= h -1.7e+75)
     (*
      (/ t_0 (sqrt (- h)))
      (* (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D d)) 2.0) l)))) (sqrt (/ d l))))
     (if (<= h -1e-311)
       (* (sqrt (/ d h)) (* (/ t_0 (sqrt (- l))) t_2))
       (* (/ (sqrt d) (sqrt h)) (* (/ 1.0 (sqrt (/ l d))) t_2))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(-d);
	double t_1 = M / (d / D);
	double t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))));
	double tmp;
	if (h <= -1.7e+75) {
		tmp = (t_0 / sqrt(-h)) * ((1.0 - (h * (0.125 * (pow((M * (D / d)), 2.0) / l)))) * sqrt((d / l)));
	} else if (h <= -1e-311) {
		tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2);
	} else {
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 / sqrt((l / d))) * t_2);
	}
	return tmp;
}
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)
    t_1 = m / (d / d_1)
    t_2 = 1.0d0 - (h * (0.125d0 * (t_1 * (t_1 / l))))
    if (h <= (-1.7d+75)) then
        tmp = (t_0 / sqrt(-h)) * ((1.0d0 - (h * (0.125d0 * (((m * (d_1 / d)) ** 2.0d0) / l)))) * sqrt((d / l)))
    else if (h <= (-1d-311)) then
        tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2)
    else
        tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 / sqrt((l / d))) * t_2)
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt(-d);
	double t_1 = M / (d / D);
	double t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))));
	double tmp;
	if (h <= -1.7e+75) {
		tmp = (t_0 / Math.sqrt(-h)) * ((1.0 - (h * (0.125 * (Math.pow((M * (D / d)), 2.0) / l)))) * Math.sqrt((d / l)));
	} else if (h <= -1e-311) {
		tmp = Math.sqrt((d / h)) * ((t_0 / Math.sqrt(-l)) * t_2);
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 / Math.sqrt((l / d))) * t_2);
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt(-d)
	t_1 = M / (d / D)
	t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))))
	tmp = 0
	if h <= -1.7e+75:
		tmp = (t_0 / math.sqrt(-h)) * ((1.0 - (h * (0.125 * (math.pow((M * (D / d)), 2.0) / l)))) * math.sqrt((d / l)))
	elif h <= -1e-311:
		tmp = math.sqrt((d / h)) * ((t_0 / math.sqrt(-l)) * t_2)
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 / math.sqrt((l / d))) * t_2)
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(-d))
	t_1 = Float64(M / Float64(d / D))
	t_2 = Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_1 * Float64(t_1 / l)))))
	tmp = 0.0
	if (h <= -1.7e+75)
		tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D / d)) ^ 2.0) / l)))) * sqrt(Float64(d / l))));
	elseif (h <= -1e-311)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * t_2));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 / sqrt(Float64(l / d))) * t_2));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt(-d);
	t_1 = M / (d / D);
	t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))));
	tmp = 0.0;
	if (h <= -1.7e+75)
		tmp = (t_0 / sqrt(-h)) * ((1.0 - (h * (0.125 * (((M * (D / d)) ^ 2.0) / l)))) * sqrt((d / l)));
	elseif (h <= -1e-311)
		tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2);
	else
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 / sqrt((l / d))) * t_2);
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(h * N[(0.125 * N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.7e+75], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-311], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := \frac{M}{\frac{d}{D}}\\
t_2 := 1 - h \cdot \left(0.125 \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\\
\mathbf{if}\;h \leq -1.7 \cdot 10^{+75}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\left(1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\

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

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


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

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

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

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

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

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

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

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

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

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

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

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

    if -1.70000000000000006e75 < h < -9.99999999999948e-312

    1. Initial program 76.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999948e-312 < h

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{-d}\\ t_1 := \frac{M}{\frac{d}{D}}\\ t_2 := 1 - h \cdot \left(0.125 \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\\ t_3 := \frac{1}{\sqrt{\frac{\ell}{d}}} \cdot t\_2\\ \mathbf{if}\;h \leq -2.6 \cdot 10^{+68}:\\ \;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot t\_3\\ \mathbf{elif}\;h \leq -1 \cdot 10^{-311}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot t\_2\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot t\_3\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (- d)))
        (t_1 (/ M (/ d D)))
        (t_2 (- 1.0 (* h (* 0.125 (* t_1 (/ t_1 l))))))
        (t_3 (* (/ 1.0 (sqrt (/ l d))) t_2)))
   (if (<= h -2.6e+68)
     (* (/ t_0 (sqrt (- h))) t_3)
     (if (<= h -1e-311)
       (* (sqrt (/ d h)) (* (/ t_0 (sqrt (- l))) t_2))
       (* (/ (sqrt d) (sqrt h)) t_3)))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(-d);
	double t_1 = M / (d / D);
	double t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))));
	double t_3 = (1.0 / sqrt((l / d))) * t_2;
	double tmp;
	if (h <= -2.6e+68) {
		tmp = (t_0 / sqrt(-h)) * t_3;
	} else if (h <= -1e-311) {
		tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2);
	} else {
		tmp = (sqrt(d) / sqrt(h)) * t_3;
	}
	return tmp;
}
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)
    t_1 = m / (d / d_1)
    t_2 = 1.0d0 - (h * (0.125d0 * (t_1 * (t_1 / l))))
    t_3 = (1.0d0 / sqrt((l / d))) * t_2
    if (h <= (-2.6d+68)) then
        tmp = (t_0 / sqrt(-h)) * t_3
    else if (h <= (-1d-311)) then
        tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2)
    else
        tmp = (sqrt(d) / sqrt(h)) * t_3
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt(-d);
	double t_1 = M / (d / D);
	double t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))));
	double t_3 = (1.0 / Math.sqrt((l / d))) * t_2;
	double tmp;
	if (h <= -2.6e+68) {
		tmp = (t_0 / Math.sqrt(-h)) * t_3;
	} else if (h <= -1e-311) {
		tmp = Math.sqrt((d / h)) * ((t_0 / Math.sqrt(-l)) * t_2);
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * t_3;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt(-d)
	t_1 = M / (d / D)
	t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))))
	t_3 = (1.0 / math.sqrt((l / d))) * t_2
	tmp = 0
	if h <= -2.6e+68:
		tmp = (t_0 / math.sqrt(-h)) * t_3
	elif h <= -1e-311:
		tmp = math.sqrt((d / h)) * ((t_0 / math.sqrt(-l)) * t_2)
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * t_3
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(-d))
	t_1 = Float64(M / Float64(d / D))
	t_2 = Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_1 * Float64(t_1 / l)))))
	t_3 = Float64(Float64(1.0 / sqrt(Float64(l / d))) * t_2)
	tmp = 0.0
	if (h <= -2.6e+68)
		tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * t_3);
	elseif (h <= -1e-311)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * t_2));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * t_3);
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt(-d);
	t_1 = M / (d / D);
	t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))));
	t_3 = (1.0 / sqrt((l / d))) * t_2;
	tmp = 0.0;
	if (h <= -2.6e+68)
		tmp = (t_0 / sqrt(-h)) * t_3;
	elseif (h <= -1e-311)
		tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2);
	else
		tmp = (sqrt(d) / sqrt(h)) * t_3;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(h * N[(0.125 * N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[h, -2.6e+68], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[h, -1e-311], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := \frac{M}{\frac{d}{D}}\\
t_2 := 1 - h \cdot \left(0.125 \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\\
t_3 := \frac{1}{\sqrt{\frac{\ell}{d}}} \cdot t\_2\\
\mathbf{if}\;h \leq -2.6 \cdot 10^{+68}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot t\_3\\

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

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


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

    1. Initial program 51.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. Simplified49.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5999999999999998e68 < h < -9.99999999999948e-312

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{1} \cdot \frac{M \cdot \frac{D}{d}}{\ell}\right)\right) + 1\right)\right) \]
      5. un-div-inv76.5%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{\frac{M}{\frac{d}{D}}}{1} \cdot \frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{\ell}\right)\right) + 1\right)\right) \]
      7. un-div-inv76.5%

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

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

    if -9.99999999999948e-312 < h

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 78.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{M}{\frac{d}{D}}\\ t_1 := 1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\\ \mathbf{if}\;h \leq -1 \cdot 10^{-311}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot t\_1\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ M (/ d D))) (t_1 (- 1.0 (* h (* 0.125 (* t_0 (/ t_0 l)))))))
   (if (<= h -1e-311)
     (* (sqrt (/ d h)) (* (/ (sqrt (- d)) (sqrt (- l))) t_1))
     (* (/ (sqrt d) (sqrt h)) (* (/ 1.0 (sqrt (/ l d))) t_1)))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	double t_1 = 1.0 - (h * (0.125 * (t_0 * (t_0 / l))));
	double tmp;
	if (h <= -1e-311) {
		tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * t_1);
	} else {
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 / sqrt((l / d))) * t_1);
	}
	return tmp;
}
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 = m / (d / d_1)
    t_1 = 1.0d0 - (h * (0.125d0 * (t_0 * (t_0 / l))))
    if (h <= (-1d-311)) then
        tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * t_1)
    else
        tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 / sqrt((l / d))) * t_1)
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	double t_1 = 1.0 - (h * (0.125 * (t_0 * (t_0 / l))));
	double tmp;
	if (h <= -1e-311) {
		tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * t_1);
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 / Math.sqrt((l / d))) * t_1);
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = M / (d / D)
	t_1 = 1.0 - (h * (0.125 * (t_0 * (t_0 / l))))
	tmp = 0
	if h <= -1e-311:
		tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * t_1)
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 / math.sqrt((l / d))) * t_1)
	return tmp
function code(d, h, l, M, D)
	t_0 = Float64(M / Float64(d / D))
	t_1 = Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 * Float64(t_0 / l)))))
	tmp = 0.0
	if (h <= -1e-311)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_1));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 / sqrt(Float64(l / d))) * t_1));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = M / (d / D);
	t_1 = 1.0 - (h * (0.125 * (t_0 * (t_0 / l))));
	tmp = 0.0;
	if (h <= -1e-311)
		tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * t_1);
	else
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 / sqrt((l / d))) * t_1);
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1e-311], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{M}{\frac{d}{D}}\\
t_1 := 1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\\
\mathbf{if}\;h \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t\_1\right)\\

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{1} \cdot \frac{M \cdot \frac{D}{d}}{\ell}\right)\right) + 1\right)\right) \]
      5. un-div-inv68.5%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{\frac{M}{\frac{d}{D}}}{1} \cdot \frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{\ell}\right)\right) + 1\right)\right) \]
      7. un-div-inv68.5%

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

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

    if -9.99999999999948e-312 < h

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 76.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \frac{M}{\frac{d}{D}}\\ t_2 := 1 - h \cdot \left(0.125 \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\\ \mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\ \;\;\;\;t\_0 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t\_2\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(t\_2 \cdot \frac{1}{\frac{\sqrt{\ell}}{\sqrt{d}}}\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d h)))
        (t_1 (/ M (/ d D)))
        (t_2 (- 1.0 (* h (* 0.125 (* t_1 (/ t_1 l)))))))
   (if (<= l -4e-310)
     (* t_0 (* (/ (sqrt (- d)) (sqrt (- l))) t_2))
     (* t_0 (* t_2 (/ 1.0 (/ (sqrt l) (sqrt d))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h));
	double t_1 = M / (d / D);
	double t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))));
	double tmp;
	if (l <= -4e-310) {
		tmp = t_0 * ((sqrt(-d) / sqrt(-l)) * t_2);
	} else {
		tmp = t_0 * (t_2 * (1.0 / (sqrt(l) / sqrt(d))));
	}
	return tmp;
}
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 / h))
    t_1 = m / (d / d_1)
    t_2 = 1.0d0 - (h * (0.125d0 * (t_1 * (t_1 / l))))
    if (l <= (-4d-310)) then
        tmp = t_0 * ((sqrt(-d) / sqrt(-l)) * t_2)
    else
        tmp = t_0 * (t_2 * (1.0d0 / (sqrt(l) / sqrt(d))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h));
	double t_1 = M / (d / D);
	double t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))));
	double tmp;
	if (l <= -4e-310) {
		tmp = t_0 * ((Math.sqrt(-d) / Math.sqrt(-l)) * t_2);
	} else {
		tmp = t_0 * (t_2 * (1.0 / (Math.sqrt(l) / Math.sqrt(d))));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = M / (d / D)
	t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))))
	tmp = 0
	if l <= -4e-310:
		tmp = t_0 * ((math.sqrt(-d) / math.sqrt(-l)) * t_2)
	else:
		tmp = t_0 * (t_2 * (1.0 / (math.sqrt(l) / math.sqrt(d))))
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = Float64(M / Float64(d / D))
	t_2 = Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_1 * Float64(t_1 / l)))))
	tmp = 0.0
	if (l <= -4e-310)
		tmp = Float64(t_0 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_2));
	else
		tmp = Float64(t_0 * Float64(t_2 * Float64(1.0 / Float64(sqrt(l) / sqrt(d)))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = M / (d / D);
	t_2 = 1.0 - (h * (0.125 * (t_1 * (t_1 / l))));
	tmp = 0.0;
	if (l <= -4e-310)
		tmp = t_0 * ((sqrt(-d) / sqrt(-l)) * t_2);
	else
		tmp = t_0 * (t_2 * (1.0 / (sqrt(l) / sqrt(d))));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(h * N[(0.125 * N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(t$95$0 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$2 * N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] / N[Sqrt[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \frac{M}{\frac{d}{D}}\\
t_2 := 1 - h \cdot \left(0.125 \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t\_2\right)\\

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{1} \cdot \frac{M \cdot \frac{D}{d}}{\ell}\right)\right) + 1\right)\right) \]
      5. un-div-inv68.5%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{\frac{M}{\frac{d}{D}}}{1} \cdot \frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{\ell}\right)\right) + 1\right)\right) \]
      7. un-div-inv68.5%

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

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

    if -3.999999999999988e-310 < l

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 71.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{M}{\frac{d}{D}}\\ t_1 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;h \leq 1.05 \cdot 10^{-211}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(t\_1 \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(\left(1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right) \cdot \frac{1}{\frac{\sqrt{\ell}}{\sqrt{d}}}\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ M (/ d D))) (t_1 (sqrt (/ d h))))
   (if (<= h 1.05e-211)
     (*
      (sqrt (/ d l))
      (* t_1 (+ 1.0 (/ (* (* h -0.5) (pow (* D (/ M (* d 2.0))) 2.0)) l))))
     (*
      t_1
      (*
       (- 1.0 (* h (* 0.125 (* t_0 (/ t_0 l)))))
       (/ 1.0 (/ (sqrt l) (sqrt d))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	double t_1 = sqrt((d / h));
	double tmp;
	if (h <= 1.05e-211) {
		tmp = sqrt((d / l)) * (t_1 * (1.0 + (((h * -0.5) * pow((D * (M / (d * 2.0))), 2.0)) / l)));
	} else {
		tmp = t_1 * ((1.0 - (h * (0.125 * (t_0 * (t_0 / l))))) * (1.0 / (sqrt(l) / sqrt(d))));
	}
	return tmp;
}
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 = m / (d / d_1)
    t_1 = sqrt((d / h))
    if (h <= 1.05d-211) then
        tmp = sqrt((d / l)) * (t_1 * (1.0d0 + (((h * (-0.5d0)) * ((d_1 * (m / (d * 2.0d0))) ** 2.0d0)) / l)))
    else
        tmp = t_1 * ((1.0d0 - (h * (0.125d0 * (t_0 * (t_0 / l))))) * (1.0d0 / (sqrt(l) / sqrt(d))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	double t_1 = Math.sqrt((d / h));
	double tmp;
	if (h <= 1.05e-211) {
		tmp = Math.sqrt((d / l)) * (t_1 * (1.0 + (((h * -0.5) * Math.pow((D * (M / (d * 2.0))), 2.0)) / l)));
	} else {
		tmp = t_1 * ((1.0 - (h * (0.125 * (t_0 * (t_0 / l))))) * (1.0 / (Math.sqrt(l) / Math.sqrt(d))));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = M / (d / D)
	t_1 = math.sqrt((d / h))
	tmp = 0
	if h <= 1.05e-211:
		tmp = math.sqrt((d / l)) * (t_1 * (1.0 + (((h * -0.5) * math.pow((D * (M / (d * 2.0))), 2.0)) / l)))
	else:
		tmp = t_1 * ((1.0 - (h * (0.125 * (t_0 * (t_0 / l))))) * (1.0 / (math.sqrt(l) / math.sqrt(d))))
	return tmp
function code(d, h, l, M, D)
	t_0 = Float64(M / Float64(d / D))
	t_1 = sqrt(Float64(d / h))
	tmp = 0.0
	if (h <= 1.05e-211)
		tmp = Float64(sqrt(Float64(d / l)) * Float64(t_1 * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l))));
	else
		tmp = Float64(t_1 * Float64(Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 * Float64(t_0 / l))))) * Float64(1.0 / Float64(sqrt(l) / sqrt(d)))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = M / (d / D);
	t_1 = sqrt((d / h));
	tmp = 0.0;
	if (h <= 1.05e-211)
		tmp = sqrt((d / l)) * (t_1 * (1.0 + (((h * -0.5) * ((D * (M / (d * 2.0))) ^ 2.0)) / l)));
	else
		tmp = t_1 * ((1.0 - (h * (0.125 * (t_0 * (t_0 / l))))) * (1.0 / (sqrt(l) / sqrt(d))));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, 1.05e-211], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] / N[Sqrt[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{M}{\frac{d}{D}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq 1.05 \cdot 10^{-211}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(t\_1 \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\

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


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

    1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

    if 1.05000000000000004e-211 < h

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 67.6% accurate, 1.0× speedup?

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

\\
\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)
\end{array}
Derivation
  1. Initial program 68.9%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 68.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{M}{\frac{d}{D}}\\ \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 + h \cdot \left(0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{-1}{\ell}\right)\right)\right)\right)\right) \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ M (/ d D))))
   (*
    (sqrt (/ d h))
    (*
     (/ 1.0 (sqrt (/ l d)))
     (+ 1.0 (* h (* 0.125 (* t_0 (* t_0 (/ -1.0 l))))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	return sqrt((d / h)) * ((1.0 / sqrt((l / d))) * (1.0 + (h * (0.125 * (t_0 * (t_0 * (-1.0 / 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
    real(8) :: t_0
    t_0 = m / (d / d_1)
    code = sqrt((d / h)) * ((1.0d0 / sqrt((l / d))) * (1.0d0 + (h * (0.125d0 * (t_0 * (t_0 * ((-1.0d0) / l)))))))
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	return Math.sqrt((d / h)) * ((1.0 / Math.sqrt((l / d))) * (1.0 + (h * (0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
}
def code(d, h, l, M, D):
	t_0 = M / (d / D)
	return math.sqrt((d / h)) * ((1.0 / math.sqrt((l / d))) * (1.0 + (h * (0.125 * (t_0 * (t_0 * (-1.0 / l)))))))
function code(d, h, l, M, D)
	t_0 = Float64(M / Float64(d / D))
	return Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(1.0 + Float64(h * Float64(0.125 * Float64(t_0 * Float64(t_0 * Float64(-1.0 / l))))))))
end
function tmp = code(d, h, l, M, D)
	t_0 = M / (d / D);
	tmp = sqrt((d / h)) * ((1.0 / sqrt((l / d))) * (1.0 + (h * (0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(0.125 * N[(t$95$0 * N[(t$95$0 * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{M}{\frac{d}{D}}\\
\sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 + h \cdot \left(0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{-1}{\ell}\right)\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 68.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. Simplified69.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\left(M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}\right) \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \frac{1}{\ell}\right)\right)\right) + 1\right)\right) \]
    5. un-div-inv72.6%

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{M}{\frac{d}{D}} \cdot \left(\left(M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}\right) \cdot \frac{1}{\ell}\right)\right)\right) + 1\right)\right) \]
    7. un-div-inv72.6%

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

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

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 + h \cdot \left(0.125 \cdot \left(\frac{M}{\frac{d}{D}} \cdot \left(\frac{M}{\frac{d}{D}} \cdot \frac{-1}{\ell}\right)\right)\right)\right)\right) \]
  12. Add Preprocessing

Alternative 10: 48.2% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;D \leq 9.5 \cdot 10^{+80}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= D 9.5e+80)
   (fabs (/ d (sqrt (* h l))))
   (*
    (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))
    (sqrt (* (/ d h) (/ d l))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (D <= 9.5e+80) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))) * sqrt(((d / h) * (d / l)));
	}
	return tmp;
}
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 <= 9.5d+80) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))) * sqrt(((d / h) * (d / l)))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (D <= 9.5e+80) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))) * Math.sqrt(((d / h) * (d / l)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if D <= 9.5e+80:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0)))) * math.sqrt(((d / h) * (d / l)))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (D <= 9.5e+80)
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))) * sqrt(Float64(Float64(d / h) * Float64(d / l))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (D <= 9.5e+80)
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))) * sqrt(((d / h) * (d / l)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[D, 9.5e+80], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;D \leq 9.5 \cdot 10^{+80}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

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


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

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\frac{d \cdot 1}{\sqrt{\ell \cdot h}}}\right| \]
      4. *-rgt-identity47.3%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{\ell \cdot h}}\right| \]
      5. *-commutative47.3%

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

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

    if 9.499999999999999e80 < D

    1. Initial program 76.0%

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

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

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

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

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

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

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

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

Alternative 11: 68.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{M}{\frac{d}{D}}\\ \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right) \cdot \sqrt{\frac{d}{h}} \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ M (/ d D))))
   (*
    (* (/ 1.0 (sqrt (/ l d))) (- 1.0 (* h (* 0.125 (* t_0 (/ t_0 l))))))
    (sqrt (/ d h)))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	return ((1.0 / sqrt((l / d))) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l)))))) * sqrt((d / h));
}
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
    t_0 = m / (d / d_1)
    code = ((1.0d0 / sqrt((l / d))) * (1.0d0 - (h * (0.125d0 * (t_0 * (t_0 / l)))))) * sqrt((d / h))
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = M / (d / D);
	return ((1.0 / Math.sqrt((l / d))) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l)))))) * Math.sqrt((d / h));
}
def code(d, h, l, M, D):
	t_0 = M / (d / D)
	return ((1.0 / math.sqrt((l / d))) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l)))))) * math.sqrt((d / h))
function code(d, h, l, M, D)
	t_0 = Float64(M / Float64(d / D))
	return Float64(Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 * Float64(t_0 / l)))))) * sqrt(Float64(d / h)))
end
function tmp = code(d, h, l, M, D)
	t_0 = M / (d / D);
	tmp = ((1.0 / sqrt((l / d))) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l)))))) * sqrt((d / h));
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{M}{\frac{d}{D}}\\
\left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right) \cdot \sqrt{\frac{d}{h}}
\end{array}
\end{array}
Derivation
  1. Initial program 68.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. Simplified69.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{1} \cdot \frac{M \cdot \frac{D}{d}}{\ell}\right)\right) + 1\right)\right) \]
    5. un-div-inv72.7%

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{\frac{M}{\frac{d}{D}}}{1} \cdot \frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{\ell}\right)\right) + 1\right)\right) \]
    7. un-div-inv72.6%

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

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

    \[\leadsto \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(\frac{M}{\frac{d}{D}} \cdot \frac{\frac{M}{\frac{d}{D}}}{\ell}\right)\right)\right)\right) \cdot \sqrt{\frac{d}{h}} \]
  12. Add Preprocessing

Alternative 12: 67.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(\frac{\frac{M}{\frac{d}{D}}}{\ell} \cdot \left(D \cdot \frac{M}{d}\right)\right)\right)\right)\right) \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (*
  (sqrt (/ d h))
  (*
   (/ 1.0 (sqrt (/ l d)))
   (- 1.0 (* h (* 0.125 (* (/ (/ M (/ d D)) l) (* D (/ M d)))))))))
double code(double d, double h, double l, double M, double D) {
	return sqrt((d / h)) * ((1.0 / sqrt((l / d))) * (1.0 - (h * (0.125 * (((M / (d / D)) / l) * (D * (M / d)))))));
}
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 = sqrt((d / h)) * ((1.0d0 / sqrt((l / d))) * (1.0d0 - (h * (0.125d0 * (((m / (d / d_1)) / l) * (d_1 * (m / d)))))))
end function
public static double code(double d, double h, double l, double M, double D) {
	return Math.sqrt((d / h)) * ((1.0 / Math.sqrt((l / d))) * (1.0 - (h * (0.125 * (((M / (d / D)) / l) * (D * (M / d)))))));
}
def code(d, h, l, M, D):
	return math.sqrt((d / h)) * ((1.0 / math.sqrt((l / d))) * (1.0 - (h * (0.125 * (((M / (d / D)) / l) * (D * (M / d)))))))
function code(d, h, l, M, D)
	return Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(1.0 - Float64(h * Float64(0.125 * Float64(Float64(Float64(M / Float64(d / D)) / l) * Float64(D * Float64(M / d))))))))
end
function tmp = code(d, h, l, M, D)
	tmp = sqrt((d / h)) * ((1.0 / sqrt((l / d))) * (1.0 - (h * (0.125 * (((M / (d / D)) / l) * (D * (M / d)))))));
end
code[d_, h_, l_, M_, D_] := N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(0.125 * N[(N[(N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(\frac{\frac{M}{\frac{d}{D}}}{\ell} \cdot \left(D \cdot \frac{M}{d}\right)\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 68.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. Simplified69.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{1} \cdot \frac{M \cdot \frac{D}{d}}{\ell}\right)\right) + 1\right)\right) \]
    5. un-div-inv72.7%

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(-h\right) \cdot \left(0.125 \cdot \left(\frac{\frac{M}{\frac{d}{D}}}{1} \cdot \frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{\ell}\right)\right) + 1\right)\right) \]
    7. un-div-inv72.6%

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

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

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

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

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

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(\frac{\frac{M}{\frac{d}{D}}}{\ell} \cdot \left(D \cdot \frac{M}{d}\right)\right)\right)\right)\right) \]
  14. Add Preprocessing

Alternative 13: 45.4% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq 2.35 \cdot 10^{-194}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d 2.35e-194)
   (* (- d) (sqrt (/ (/ 1.0 h) l)))
   (/ d (* (sqrt h) (sqrt l)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 2.35e-194) {
		tmp = -d * sqrt(((1.0 / h) / l));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
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 <= 2.35d-194) then
        tmp = -d * sqrt(((1.0d0 / h) / l))
    else
        tmp = d / (sqrt(h) * sqrt(l))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 2.35e-194) {
		tmp = -d * Math.sqrt(((1.0 / h) / l));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if d <= 2.35e-194:
		tmp = -d * math.sqrt(((1.0 / h) / l))
	else:
		tmp = d / (math.sqrt(h) * math.sqrt(l))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= 2.35e-194)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l)));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= 2.35e-194)
		tmp = -d * sqrt(((1.0 / h) / l));
	else
		tmp = d / (sqrt(h) * sqrt(l));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 2.35e-194], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.35 \cdot 10^{-194}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\

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


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

    1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

    if 2.3500000000000001e-194 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 41.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;h \leq 5.1 \cdot 10^{+225}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= h 5.1e+225) (fabs (/ d (sqrt (* h l)))) (sqrt (* (/ d h) (/ d l)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= 5.1e+225) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = sqrt(((d / h) * (d / l)));
	}
	return tmp;
}
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 <= 5.1d+225) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = sqrt(((d / h) * (d / l)))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= 5.1e+225) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = Math.sqrt(((d / h) * (d / l)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if h <= 5.1e+225:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = math.sqrt(((d / h) * (d / l)))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (h <= 5.1e+225)
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = sqrt(Float64(Float64(d / h) * Float64(d / l)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (h <= 5.1e+225)
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = sqrt(((d / h) * (d / l)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, 5.1e+225], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;h \leq 5.1 \cdot 10^{+225}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < 5.0999999999999999e225

    1. Initial program 68.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\frac{d \cdot 1}{\sqrt{\ell \cdot h}}}\right| \]
      4. *-rgt-identity47.0%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{\ell \cdot h}}\right| \]
      5. *-commutative47.0%

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

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

    if 5.0999999999999999e225 < h

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}} \]
      6. pow1/253.4%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq 5.1 \cdot 10^{+225}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 35.7% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;h \leq -1.3 \cdot 10^{-232} \lor \neg \left(h \leq 2.7 \cdot 10^{+225}\right):\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (or (<= h -1.3e-232) (not (<= h 2.7e+225)))
   (sqrt (* (/ d h) (/ d l)))
   (* d (pow (* h l) -0.5))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if ((h <= -1.3e-232) || !(h <= 2.7e+225)) {
		tmp = sqrt(((d / h) * (d / l)));
	} else {
		tmp = d * pow((h * l), -0.5);
	}
	return tmp;
}
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 <= (-1.3d-232)) .or. (.not. (h <= 2.7d+225))) then
        tmp = sqrt(((d / h) * (d / l)))
    else
        tmp = d * ((h * l) ** (-0.5d0))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if ((h <= -1.3e-232) || !(h <= 2.7e+225)) {
		tmp = Math.sqrt(((d / h) * (d / l)));
	} else {
		tmp = d * Math.pow((h * l), -0.5);
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if (h <= -1.3e-232) or not (h <= 2.7e+225):
		tmp = math.sqrt(((d / h) * (d / l)))
	else:
		tmp = d * math.pow((h * l), -0.5)
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if ((h <= -1.3e-232) || !(h <= 2.7e+225))
		tmp = sqrt(Float64(Float64(d / h) * Float64(d / l)));
	else
		tmp = Float64(d * (Float64(h * l) ^ -0.5));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if ((h <= -1.3e-232) || ~((h <= 2.7e+225)))
		tmp = sqrt(((d / h) * (d / l)));
	else
		tmp = d * ((h * l) ^ -0.5);
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[Or[LessEqual[h, -1.3e-232], N[Not[LessEqual[h, 2.7e+225]], $MachinePrecision]], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.3 \cdot 10^{-232} \lor \neg \left(h \leq 2.7 \cdot 10^{+225}\right):\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < -1.29999999999999998e-232 or 2.6999999999999999e225 < h

    1. Initial program 66.1%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\left(-\sqrt{\frac{d}{\ell}}\right)} \]
    6. Simplified7.4%

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}} \]
      6. pow1/244.9%

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

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

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

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

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

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

    if -1.29999999999999998e-232 < h < 2.6999999999999999e225

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -1.3 \cdot 10^{-232} \lor \neg \left(h \leq 2.7 \cdot 10^{+225}\right):\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 39.6% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;h \leq -1.3 \cdot 10^{-232}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{elif}\;h \leq 4.4 \cdot 10^{+225}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= h -1.3e-232)
   (* (- d) (sqrt (/ (/ 1.0 h) l)))
   (if (<= h 4.4e+225) (* d (pow (* h l) -0.5)) (sqrt (* (/ d h) (/ d l))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -1.3e-232) {
		tmp = -d * sqrt(((1.0 / h) / l));
	} else if (h <= 4.4e+225) {
		tmp = d * pow((h * l), -0.5);
	} else {
		tmp = sqrt(((d / h) * (d / l)));
	}
	return tmp;
}
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 <= (-1.3d-232)) then
        tmp = -d * sqrt(((1.0d0 / h) / l))
    else if (h <= 4.4d+225) then
        tmp = d * ((h * l) ** (-0.5d0))
    else
        tmp = sqrt(((d / h) * (d / l)))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -1.3e-232) {
		tmp = -d * Math.sqrt(((1.0 / h) / l));
	} else if (h <= 4.4e+225) {
		tmp = d * Math.pow((h * l), -0.5);
	} else {
		tmp = Math.sqrt(((d / h) * (d / l)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if h <= -1.3e-232:
		tmp = -d * math.sqrt(((1.0 / h) / l))
	elif h <= 4.4e+225:
		tmp = d * math.pow((h * l), -0.5)
	else:
		tmp = math.sqrt(((d / h) * (d / l)))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (h <= -1.3e-232)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l)));
	elseif (h <= 4.4e+225)
		tmp = Float64(d * (Float64(h * l) ^ -0.5));
	else
		tmp = sqrt(Float64(Float64(d / h) * Float64(d / l)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (h <= -1.3e-232)
		tmp = -d * sqrt(((1.0 / h) / l));
	elseif (h <= 4.4e+225)
		tmp = d * ((h * l) ^ -0.5);
	else
		tmp = sqrt(((d / h) * (d / l)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -1.3e-232], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 4.4e+225], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.3 \cdot 10^{-232}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\

\mathbf{elif}\;h \leq 4.4 \cdot 10^{+225}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\

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


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

    1. Initial program 64.7%

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

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

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

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

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

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

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

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

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

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

    if -1.29999999999999998e-232 < h < 4.40000000000000028e225

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.40000000000000028e225 < h

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}} \]
      6. pow1/253.4%

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

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

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

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

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

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

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

Alternative 17: 39.5% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{if}\;h \leq -1.35 \cdot 10^{-232}:\\ \;\;\;\;d \cdot \left(-t\_0\right)\\ \mathbf{elif}\;h \leq 4.4 \cdot 10^{+225}:\\ \;\;\;\;d \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (* h l) -0.5)))
   (if (<= h -1.35e-232)
     (* d (- t_0))
     (if (<= h 4.4e+225) (* d t_0) (sqrt (* (/ d h) (/ d l)))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow((h * l), -0.5);
	double tmp;
	if (h <= -1.35e-232) {
		tmp = d * -t_0;
	} else if (h <= 4.4e+225) {
		tmp = d * t_0;
	} else {
		tmp = sqrt(((d / h) * (d / l)));
	}
	return tmp;
}
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 = (h * l) ** (-0.5d0)
    if (h <= (-1.35d-232)) then
        tmp = d * -t_0
    else if (h <= 4.4d+225) then
        tmp = d * t_0
    else
        tmp = sqrt(((d / h) * (d / l)))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow((h * l), -0.5);
	double tmp;
	if (h <= -1.35e-232) {
		tmp = d * -t_0;
	} else if (h <= 4.4e+225) {
		tmp = d * t_0;
	} else {
		tmp = Math.sqrt(((d / h) * (d / l)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.pow((h * l), -0.5)
	tmp = 0
	if h <= -1.35e-232:
		tmp = d * -t_0
	elif h <= 4.4e+225:
		tmp = d * t_0
	else:
		tmp = math.sqrt(((d / h) * (d / l)))
	return tmp
function code(d, h, l, M, D)
	t_0 = Float64(h * l) ^ -0.5
	tmp = 0.0
	if (h <= -1.35e-232)
		tmp = Float64(d * Float64(-t_0));
	elseif (h <= 4.4e+225)
		tmp = Float64(d * t_0);
	else
		tmp = sqrt(Float64(Float64(d / h) * Float64(d / l)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = (h * l) ^ -0.5;
	tmp = 0.0;
	if (h <= -1.35e-232)
		tmp = d * -t_0;
	elseif (h <= 4.4e+225)
		tmp = d * t_0;
	else
		tmp = sqrt(((d / h) * (d / l)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[h, -1.35e-232], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[h, 4.4e+225], N[(d * t$95$0), $MachinePrecision], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;h \leq -1.35 \cdot 10^{-232}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\

\mathbf{elif}\;h \leq 4.4 \cdot 10^{+225}:\\
\;\;\;\;d \cdot t\_0\\

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


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

    1. Initial program 64.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      12. neg-mul-147.3%

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

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

    if -1.35e-232 < h < 4.40000000000000028e225

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.40000000000000028e225 < h

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}} \]
      6. pow1/253.4%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -1.35 \cdot 10^{-232}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;h \leq 4.4 \cdot 10^{+225}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 25.7% accurate, 3.1× speedup?

\[\begin{array}{l} \\ d \cdot {\left(h \cdot \ell\right)}^{-0.5} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (pow (* h l) -0.5)))
double code(double d, double h, double l, double M, double D) {
	return d * pow((h * l), -0.5);
}
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
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.pow((h * l), -0.5);
}
def code(d, h, l, M, D):
	return d * math.pow((h * l), -0.5)
function code(d, h, l, M, D)
	return Float64(d * (Float64(h * l) ^ -0.5))
end
function tmp = code(d, h, l, M, D)
	tmp = d * ((h * l) ^ -0.5);
end
code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 19: 25.7% accurate, 3.2× speedup?

\[\begin{array}{l} \\ \frac{d}{\sqrt{h \cdot \ell}} \end{array} \]
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
double code(double d, double h, double l, double M, double D) {
	return d / sqrt((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 / sqrt((h * l))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d / Math.sqrt((h * l));
}
def code(d, h, l, M, D):
	return d / math.sqrt((h * l))
function code(d, h, l, M, D)
	return Float64(d / sqrt(Float64(h * l)))
end
function tmp = code(d, h, l, M, D)
	tmp = d / sqrt((h * l));
end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Derivation
  1. Initial program 68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{d}}{\sqrt{\ell \cdot h}} \]
    4. *-commutative25.3%

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

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  13. Add Preprocessing

Reproduce

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