Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.6% → 82.8%
Time: 29.0s
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.6% 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: 82.8% accurate, 0.6× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

    if -1.1e-64 < l < -1.999999999999994e-310

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 69.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. Simplified68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{-241}:\\
\;\;\;\;\frac{t_0}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M \cdot -0.5\right)\right)}^{2}}{\ell}\right)\right)\\

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

    if -6.1999999999999998e-241 < l < -1.999999999999994e-310

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 69.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. Simplified68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 79.1% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

    if -2.70000000000000018e-240 < l < -1.999999999999994e-310

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 69.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. Simplified68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 79.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -3.8 \cdot 10^{-241}:\\
\;\;\;\;\frac{t_0}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M \cdot -0.5\right)\right)}^{2}}{\ell}\right)\right)\\

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

    if -3.7999999999999999e-241 < l < -1.999999999999994e-310

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 69.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. Simplified68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 77.9% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;\ell \leq 7 \cdot 10^{-277}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \frac{-0.5}{\frac{1}{t_0} \cdot \frac{\ell}{t_0}}\right)\right)\\

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


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

    1. Initial program 71.1%

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

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

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

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

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

    if -1.3999999999999999e-231 < l < 6.99999999999999966e-277

    1. Initial program 64.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.99999999999999966e-277 < l

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.1% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 70.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. Simplified71.3%

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 69.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. Simplified68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 76.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \left(M \cdot D\right) \cdot \frac{0.5}{d}\\
\mathbf{if}\;\ell \leq -8 \cdot 10^{+134}:\\
\;\;\;\;d \cdot \left({\left(-\ell\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{h}\right)}^{0.5}\right)\right)\\

\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-275}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \frac{-0.5}{\frac{1}{t_0} \cdot \frac{\ell}{t_0}}\right)\right)\\

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


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

    1. Initial program 56.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. Simplified58.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. unpow1/261.3%

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

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

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

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

        \[\leadsto -e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      8. distribute-rgt-neg-in57.3%

        \[\leadsto -e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot d \]
      9. metadata-eval57.3%

        \[\leadsto -e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot d \]
      10. exp-to-pow61.3%

        \[\leadsto -\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
      11. distribute-rgt-neg-in61.3%

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

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

      \[\leadsto \color{blue}{e^{-0.5 \cdot \left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)}} \cdot \left(-d\right) \]
    12. Step-by-step derivation
      1. distribute-lft-in71.0%

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

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

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

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

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

        \[\leadsto \left({\left(-\ell\right)}^{-0.5} \cdot e^{\color{blue}{\left(-1 \cdot \log \left(\frac{-1}{h}\right)\right) \cdot -0.5}}\right) \cdot \left(-d\right) \]
      7. *-commutative72.6%

        \[\leadsto \left({\left(-\ell\right)}^{-0.5} \cdot e^{\color{blue}{\left(\log \left(\frac{-1}{h}\right) \cdot -1\right)} \cdot -0.5}\right) \cdot \left(-d\right) \]
      8. associate-*l*72.6%

        \[\leadsto \left({\left(-\ell\right)}^{-0.5} \cdot e^{\color{blue}{\log \left(\frac{-1}{h}\right) \cdot \left(-1 \cdot -0.5\right)}}\right) \cdot \left(-d\right) \]
      9. metadata-eval72.6%

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

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

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

    if -7.99999999999999937e134 < l < 2.69999999999999993e-275

    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. Simplified75.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.69999999999999993e-275 < l

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 71.7% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_0 := \left(M \cdot D\right) \cdot \frac{0.5}{d}\\
\mathbf{if}\;\ell \leq -1.3 \cdot 10^{+134}:\\
\;\;\;\;d \cdot \left({\left(-\ell\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{h}\right)}^{0.5}\right)\right)\\

\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+121}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \frac{-0.5}{\frac{1}{t_0} \cdot \frac{\ell}{t_0}}\right)\right)\\

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


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

    1. Initial program 56.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. Simplified58.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. unpow1/261.3%

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

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

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

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

        \[\leadsto -e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      8. distribute-rgt-neg-in57.3%

        \[\leadsto -e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot d \]
      9. metadata-eval57.3%

        \[\leadsto -e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot d \]
      10. exp-to-pow61.3%

        \[\leadsto -\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
      11. distribute-rgt-neg-in61.3%

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

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

      \[\leadsto \color{blue}{e^{-0.5 \cdot \left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)}} \cdot \left(-d\right) \]
    12. Step-by-step derivation
      1. distribute-lft-in71.0%

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

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

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

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

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

        \[\leadsto \left({\left(-\ell\right)}^{-0.5} \cdot e^{\color{blue}{\left(-1 \cdot \log \left(\frac{-1}{h}\right)\right) \cdot -0.5}}\right) \cdot \left(-d\right) \]
      7. *-commutative72.6%

        \[\leadsto \left({\left(-\ell\right)}^{-0.5} \cdot e^{\color{blue}{\left(\log \left(\frac{-1}{h}\right) \cdot -1\right)} \cdot -0.5}\right) \cdot \left(-d\right) \]
      8. associate-*l*72.6%

        \[\leadsto \left({\left(-\ell\right)}^{-0.5} \cdot e^{\color{blue}{\log \left(\frac{-1}{h}\right) \cdot \left(-1 \cdot -0.5\right)}}\right) \cdot \left(-d\right) \]
      9. metadata-eval72.6%

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

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

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

    if -1.3000000000000001e134 < l < 8.5e121

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.5e121 < l

    1. Initial program 59.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. Simplified59.5%

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

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

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

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

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

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

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

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

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

Alternative 9: 47.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -4.3 \cdot 10^{-242}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-309}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq 1.55 \cdot 10^{-253}:\\ \;\;\;\;d \cdot \left(-e^{0.5 \cdot \left(-\mathsf{log1p}\left(-1 + \ell \cdot h\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -4.3e-242)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (if (<= l -5e-309)
     (/ d (sqrt (* l h)))
     (if (<= l 1.55e-253)
       (* d (- (exp (* 0.5 (- (log1p (+ -1.0 (* l h))))))))
       (/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -4.3e-242) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else if (l <= -5e-309) {
		tmp = d / sqrt((l * h));
	} else if (l <= 1.55e-253) {
		tmp = d * -exp((0.5 * -log1p((-1.0 + (l * h)))));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -4.3e-242) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else if (l <= -5e-309) {
		tmp = d / Math.sqrt((l * h));
	} else if (l <= 1.55e-253) {
		tmp = d * -Math.exp((0.5 * -Math.log1p((-1.0 + (l * h)))));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if l <= -4.3e-242:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	elif l <= -5e-309:
		tmp = d / math.sqrt((l * h))
	elif l <= 1.55e-253:
		tmp = d * -math.exp((0.5 * -math.log1p((-1.0 + (l * h)))))
	else:
		tmp = d / (math.sqrt(h) * math.sqrt(l))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -4.3e-242)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	elseif (l <= -5e-309)
		tmp = Float64(d / sqrt(Float64(l * h)));
	elseif (l <= 1.55e-253)
		tmp = Float64(d * Float64(-exp(Float64(0.5 * Float64(-log1p(Float64(-1.0 + Float64(l * h))))))));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.3e-242], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -5e-309], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.55e-253], N[(d * (-N[Exp[N[(0.5 * (-N[Log[1 + N[(-1.0 + N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\

\mathbf{elif}\;\ell \leq 1.55 \cdot 10^{-253}:\\
\;\;\;\;d \cdot \left(-e^{0.5 \cdot \left(-\mathsf{log1p}\left(-1 + \ell \cdot h\right)\right)}\right)\\

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


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

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Step-by-step derivation
      1. expm1-log1p-u48.9%

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

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

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

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

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

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

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

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

    if -4.3000000000000002e-242 < l < -4.9999999999999995e-309

    1. Initial program 74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e-309 < l < 1.54999999999999998e-253

    1. Initial program 69.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. Simplified69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.54999999999999998e-253 < l

    1. Initial program 69.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. Simplified68.5%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.3 \cdot 10^{-242}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-309}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq 1.55 \cdot 10^{-253}:\\ \;\;\;\;d \cdot \left(-e^{0.5 \cdot \left(-\mathsf{log1p}\left(-1 + \ell \cdot h\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]

Alternative 10: 51.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.3 \cdot 10^{-244}:\\ \;\;\;\;d \cdot \left({\left(-\ell\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{h}\right)}^{0.5}\right)\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq 3.2 \cdot 10^{-254}:\\ \;\;\;\;d \cdot \left(-e^{0.5 \cdot \left(-\mathsf{log1p}\left(-1 + \ell \cdot h\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -2.3e-244)
   (* d (* (pow (- l) -0.5) (- (pow (/ -1.0 h) 0.5))))
   (if (<= l -2e-310)
     (/ d (sqrt (* l h)))
     (if (<= l 3.2e-254)
       (* d (- (exp (* 0.5 (- (log1p (+ -1.0 (* l h))))))))
       (/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.3e-244) {
		tmp = d * (pow(-l, -0.5) * -pow((-1.0 / h), 0.5));
	} else if (l <= -2e-310) {
		tmp = d / sqrt((l * h));
	} else if (l <= 3.2e-254) {
		tmp = d * -exp((0.5 * -log1p((-1.0 + (l * h)))));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.3e-244) {
		tmp = d * (Math.pow(-l, -0.5) * -Math.pow((-1.0 / h), 0.5));
	} else if (l <= -2e-310) {
		tmp = d / Math.sqrt((l * h));
	} else if (l <= 3.2e-254) {
		tmp = d * -Math.exp((0.5 * -Math.log1p((-1.0 + (l * h)))));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if l <= -2.3e-244:
		tmp = d * (math.pow(-l, -0.5) * -math.pow((-1.0 / h), 0.5))
	elif l <= -2e-310:
		tmp = d / math.sqrt((l * h))
	elif l <= 3.2e-254:
		tmp = d * -math.exp((0.5 * -math.log1p((-1.0 + (l * h)))))
	else:
		tmp = d / (math.sqrt(h) * math.sqrt(l))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -2.3e-244)
		tmp = Float64(d * Float64((Float64(-l) ^ -0.5) * Float64(-(Float64(-1.0 / h) ^ 0.5))));
	elseif (l <= -2e-310)
		tmp = Float64(d / sqrt(Float64(l * h)));
	elseif (l <= 3.2e-254)
		tmp = Float64(d * Float64(-exp(Float64(0.5 * Float64(-log1p(Float64(-1.0 + Float64(l * h))))))));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.3e-244], N[(d * N[(N[Power[(-l), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / h), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.2e-254], N[(d * (-N[Exp[N[(0.5 * (-N[Log[1 + N[(-1.0 + N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\

\mathbf{elif}\;\ell \leq 3.2 \cdot 10^{-254}:\\
\;\;\;\;d \cdot \left(-e^{0.5 \cdot \left(-\mathsf{log1p}\left(-1 + \ell \cdot h\right)\right)}\right)\\

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


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

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. unpow1/250.2%

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

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

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

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

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

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

        \[\leadsto -e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot d \]
      10. exp-to-pow50.6%

        \[\leadsto -\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
      11. distribute-rgt-neg-in50.6%

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

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

      \[\leadsto \color{blue}{e^{-0.5 \cdot \left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)}} \cdot \left(-d\right) \]
    12. Step-by-step derivation
      1. distribute-lft-in53.9%

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

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

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

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

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

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

        \[\leadsto \left({\left(-\ell\right)}^{-0.5} \cdot e^{\color{blue}{\left(\log \left(\frac{-1}{h}\right) \cdot -1\right)} \cdot -0.5}\right) \cdot \left(-d\right) \]
      8. associate-*l*54.8%

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

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

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

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

    if -2.3e-244 < l < -1.999999999999994e-310

    1. Initial program 74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l < 3.2e-254

    1. Initial program 69.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. Simplified69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.2e-254 < l

    1. Initial program 69.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. Simplified68.5%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.3 \cdot 10^{-244}:\\ \;\;\;\;d \cdot \left({\left(-\ell\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{h}\right)}^{0.5}\right)\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq 3.2 \cdot 10^{-254}:\\ \;\;\;\;d \cdot \left(-e^{0.5 \cdot \left(-\mathsf{log1p}\left(-1 + \ell \cdot h\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]

Alternative 11: 41.9% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;\ell \leq 2 \cdot 10^{+86}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

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


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

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Step-by-step derivation
      1. expm1-log1p-u48.9%

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

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

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

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

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

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

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

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

    if -4.80000000000000032e-244 < l < 2e86

    1. Initial program 73.7%

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    4. Taylor expanded in d around 0 45.1%

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

    if 2e86 < l

    1. Initial program 60.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.8 \cdot 10^{-244}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{+86}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \]

Alternative 12: 46.3% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\

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


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

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Step-by-step derivation
      1. expm1-log1p-u48.9%

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

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

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

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

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

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

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

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

    if -1.74999999999999996e-244 < l < -1.999999999999994e-310

    1. Initial program 74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 69.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. Simplified68.6%

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

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

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

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

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

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

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

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

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

Alternative 13: 42.5% accurate, 3.0× speedup?

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

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

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


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

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. unpow1/250.2%

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

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

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

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

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

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

        \[\leadsto -e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot d \]
      10. exp-to-pow50.6%

        \[\leadsto -\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
      11. distribute-rgt-neg-in50.6%

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

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

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

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

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

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

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

    if -1.9499999999999999e-244 < l

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 42.5% accurate, 3.0× speedup?

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

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

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


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

    1. Initial program 70.1%

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      2. sqrt-div83.4%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    4. Applied egg-rr83.4%

      \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    5. Taylor expanded in d around -inf 50.2%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg50.2%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in50.2%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Simplified50.2%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Step-by-step derivation
      1. expm1-log1p-u48.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)\right)}}\right) \]
      2. expm1-udef25.1%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)} - 1}}\right) \]
    9. Applied egg-rr25.1%

      \[\leadsto d \cdot \left(-\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)} - 1}}\right) \]
    10. Step-by-step derivation
      1. expm1-def48.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)\right)}}\right) \]
      2. expm1-log1p50.2%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{1}{h \cdot \ell}}}\right) \]
      3. *-commutative50.2%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      4. associate-/r*51.7%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    11. Simplified51.7%

      \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]

    if -1.70000000000000004e-244 < l

    1. Initial program 69.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left({\left(\frac{-0.5 \cdot M}{d} \cdot D\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)} \]
    3. Taylor expanded in M around 0 41.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. sqrt-div76.3%

        \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
      2. div-inv76.3%

        \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\color{blue}{\left(\sqrt{d} \cdot \frac{1}{\sqrt{\ell}}\right)} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
    5. Applied egg-rr47.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\left(\sqrt{d} \cdot \frac{1}{\sqrt{\ell}}\right)}\right) \cdot 1 \]
    6. Step-by-step derivation
      1. associate-*r/76.3%

        \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\color{blue}{\frac{\sqrt{d} \cdot 1}{\sqrt{\ell}}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
      2. *-rgt-identity76.3%

        \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\frac{\color{blue}{\sqrt{d}}}{\sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
    7. Simplified47.3%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}\right) \cdot 1 \]
    8. Step-by-step derivation
      1. expm1-log1p-u45.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\right)} \cdot 1 \]
      2. expm1-udef30.6%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)} - 1\right)} \cdot 1 \]
      3. *-commutative30.6%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \sqrt{\frac{d}{h}}}\right)} - 1\right) \cdot 1 \]
      4. sqrt-div34.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}}\right)} - 1\right) \cdot 1 \]
      5. frac-times34.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}}\right)} - 1\right) \cdot 1 \]
      6. add-sqr-sqrt34.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{d}}{\sqrt{\ell} \cdot \sqrt{h}}\right)} - 1\right) \cdot 1 \]
      7. sqrt-prod28.6%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{d}{\color{blue}{\sqrt{\ell \cdot h}}}\right)} - 1\right) \cdot 1 \]
    9. Applied egg-rr28.6%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1\right)} \cdot 1 \]
    10. Step-by-step derivation
      1. expm1-def40.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \cdot 1 \]
      2. expm1-log1p46.5%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot 1 \]
    11. Simplified46.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.7 \cdot 10^{-244}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]

Alternative 15: 42.4% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -5.2 \cdot 10^{-243}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -5.2e-243)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (* d (pow (* l h) -0.5))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -5.2e-243) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else {
		tmp = d * pow((l * h), -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 (l <= (-5.2d-243)) then
        tmp = d * -sqrt(((1.0d0 / l) / h))
    else
        tmp = d * ((l * h) ** (-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 (l <= -5.2e-243) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = d * Math.pow((l * h), -0.5);
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if l <= -5.2e-243:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	else:
		tmp = d * math.pow((l * h), -0.5)
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -5.2e-243)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	else
		tmp = Float64(d * (Float64(l * h) ^ -0.5));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -5.2e-243)
		tmp = d * -sqrt(((1.0 / l) / h));
	else
		tmp = d * ((l * h) ^ -0.5);
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5.2e-243], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.2 \cdot 10^{-243}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -5.1999999999999995e-243

    1. Initial program 70.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    3. Step-by-step derivation
      1. frac-2neg70.9%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      2. sqrt-div83.4%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    4. Applied egg-rr83.4%

      \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    5. Taylor expanded in d around -inf 50.2%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg50.2%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in50.2%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Simplified50.2%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Step-by-step derivation
      1. expm1-log1p-u48.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)\right)}}\right) \]
      2. expm1-udef25.1%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)} - 1}}\right) \]
    9. Applied egg-rr25.1%

      \[\leadsto d \cdot \left(-\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)} - 1}}\right) \]
    10. Step-by-step derivation
      1. expm1-def48.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)\right)}}\right) \]
      2. expm1-log1p50.2%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{1}{h \cdot \ell}}}\right) \]
      3. *-commutative50.2%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      4. associate-/r*51.7%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    11. Simplified51.7%

      \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]

    if -5.1999999999999995e-243 < l

    1. Initial program 69.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left({\left(\frac{-0.5 \cdot M}{d} \cdot D\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)} \]
    3. Taylor expanded in M around 0 41.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. pow1/241.2%

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
      2. metadata-eval41.2%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
      3. add-cbrt-cube35.2%

        \[\leadsto \left(\color{blue}{\sqrt[3]{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
      4. pow1/333.8%

        \[\leadsto \left(\color{blue}{{\left(\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)}^{0.3333333333333333}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
      5. sqr-pow33.8%

        \[\leadsto \left({\left(\color{blue}{{\left(\frac{d}{h}\right)}^{1}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)}^{0.3333333333333333} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
      6. pow-prod-up33.8%

        \[\leadsto \left({\color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(1 + \frac{1}{2}\right)}\right)}}^{0.3333333333333333} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
      7. metadata-eval33.8%

        \[\leadsto \left({\left({\left(\frac{d}{h}\right)}^{\left(1 + \color{blue}{0.5}\right)}\right)}^{0.3333333333333333} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
      8. metadata-eval33.8%

        \[\leadsto \left({\left({\left(\frac{d}{h}\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
    5. Applied egg-rr33.8%

      \[\leadsto \left(\color{blue}{{\left({\left(\frac{d}{h}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
    6. Step-by-step derivation
      1. unpow1/335.2%

        \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(\frac{d}{h}\right)}^{1.5}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
    7. Simplified35.2%

      \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(\frac{d}{h}\right)}^{1.5}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot 1 \]
    8. Taylor expanded in d around 0 46.6%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot 1 \]
    9. Step-by-step derivation
      1. unpow1/246.6%

        \[\leadsto \left(d \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \cdot 1 \]
      2. rem-exp-log44.3%

        \[\leadsto \left(d \cdot {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5}\right) \cdot 1 \]
      3. exp-neg44.3%

        \[\leadsto \left(d \cdot {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5}\right) \cdot 1 \]
      4. exp-prod44.3%

        \[\leadsto \left(d \cdot \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}}\right) \cdot 1 \]
      5. distribute-lft-neg-out44.3%

        \[\leadsto \left(d \cdot e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \cdot 1 \]
      6. distribute-rgt-neg-in44.3%

        \[\leadsto \left(d \cdot e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \cdot 1 \]
      7. metadata-eval44.3%

        \[\leadsto \left(d \cdot e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \cdot 1 \]
      8. exp-to-pow46.6%

        \[\leadsto \left(d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \cdot 1 \]
    10. Simplified46.6%

      \[\leadsto \color{blue}{\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5.2 \cdot 10^{-243}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \end{array} \]

Alternative 16: 42.5% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.3 \cdot 10^{-243}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -1.3e-243)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (* d (sqrt (/ 1.0 (* l h))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.3e-243) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else {
		tmp = d * sqrt((1.0 / (l * h)));
	}
	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 (l <= (-1.3d-243)) then
        tmp = d * -sqrt(((1.0d0 / l) / h))
    else
        tmp = d * sqrt((1.0d0 / (l * h)))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.3e-243) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = d * Math.sqrt((1.0 / (l * h)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if l <= -1.3e-243:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	else:
		tmp = d * math.sqrt((1.0 / (l * h)))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -1.3e-243)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	else
		tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -1.3e-243)
		tmp = d * -sqrt(((1.0 / l) / h));
	else
		tmp = d * sqrt((1.0 / (l * h)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.3e-243], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.3 \cdot 10^{-243}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -1.2999999999999999e-243

    1. Initial program 70.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    3. Step-by-step derivation
      1. frac-2neg70.9%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      2. sqrt-div83.4%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    4. Applied egg-rr83.4%

      \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    5. Taylor expanded in d around -inf 50.2%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg50.2%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in50.2%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Simplified50.2%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Step-by-step derivation
      1. expm1-log1p-u48.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)\right)}}\right) \]
      2. expm1-udef25.1%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)} - 1}}\right) \]
    9. Applied egg-rr25.1%

      \[\leadsto d \cdot \left(-\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)} - 1}}\right) \]
    10. Step-by-step derivation
      1. expm1-def48.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{h \cdot \ell}\right)\right)}}\right) \]
      2. expm1-log1p50.2%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{1}{h \cdot \ell}}}\right) \]
      3. *-commutative50.2%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      4. associate-/r*51.7%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    11. Simplified51.7%

      \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]

    if -1.2999999999999999e-243 < l

    1. Initial program 69.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left({\left(\frac{-0.5 \cdot M}{d} \cdot D\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)} \]
    3. Taylor expanded in M around 0 41.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    4. Taylor expanded in d around 0 46.6%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.3 \cdot 10^{-243}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \end{array} \]

Alternative 17: 42.4% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -7.5 \cdot 10^{-244}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -7.5e-244) (* d (- (pow (* l h) -0.5))) (/ d (sqrt (* l h)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -7.5e-244) {
		tmp = d * -pow((l * h), -0.5);
	} else {
		tmp = d / sqrt((l * h));
	}
	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 (l <= (-7.5d-244)) then
        tmp = d * -((l * h) ** (-0.5d0))
    else
        tmp = d / sqrt((l * h))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -7.5e-244) {
		tmp = d * -Math.pow((l * h), -0.5);
	} else {
		tmp = d / Math.sqrt((l * h));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if l <= -7.5e-244:
		tmp = d * -math.pow((l * h), -0.5)
	else:
		tmp = d / math.sqrt((l * h))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -7.5e-244)
		tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d / sqrt(Float64(l * h)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -7.5e-244)
		tmp = d * -((l * h) ^ -0.5);
	else
		tmp = d / sqrt((l * h));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -7.5e-244], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.5 \cdot 10^{-244}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -7.5000000000000003e-244

    1. Initial program 70.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    3. Step-by-step derivation
      1. frac-2neg70.9%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      2. sqrt-div83.4%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    4. Applied egg-rr83.4%

      \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    5. Taylor expanded in d around -inf 50.2%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg50.2%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in50.2%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Simplified50.2%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Taylor expanded in d around 0 50.2%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg50.2%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative50.2%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. unpow1/250.2%

        \[\leadsto -\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
      4. rem-exp-log47.2%

        \[\leadsto -{\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      5. exp-neg47.2%

        \[\leadsto -{\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
      6. exp-prod47.6%

        \[\leadsto -\color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
      7. distribute-lft-neg-out47.6%

        \[\leadsto -e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
      8. distribute-rgt-neg-in47.6%

        \[\leadsto -e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot d \]
      9. metadata-eval47.6%

        \[\leadsto -e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot d \]
      10. exp-to-pow50.6%

        \[\leadsto -\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
      11. distribute-rgt-neg-in50.6%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]
    10. Simplified50.6%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]

    if -7.5000000000000003e-244 < l

    1. Initial program 69.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left({\left(\frac{-0.5 \cdot M}{d} \cdot D\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)} \]
    3. Taylor expanded in M around 0 41.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. sqrt-div76.3%

        \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
      2. div-inv76.3%

        \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\color{blue}{\left(\sqrt{d} \cdot \frac{1}{\sqrt{\ell}}\right)} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
    5. Applied egg-rr47.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\left(\sqrt{d} \cdot \frac{1}{\sqrt{\ell}}\right)}\right) \cdot 1 \]
    6. Step-by-step derivation
      1. associate-*r/76.3%

        \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\color{blue}{\frac{\sqrt{d} \cdot 1}{\sqrt{\ell}}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
      2. *-rgt-identity76.3%

        \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\frac{\color{blue}{\sqrt{d}}}{\sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
    7. Simplified47.3%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}\right) \cdot 1 \]
    8. Step-by-step derivation
      1. expm1-log1p-u45.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\right)} \cdot 1 \]
      2. expm1-udef30.6%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)} - 1\right)} \cdot 1 \]
      3. *-commutative30.6%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \sqrt{\frac{d}{h}}}\right)} - 1\right) \cdot 1 \]
      4. sqrt-div34.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}}\right)} - 1\right) \cdot 1 \]
      5. frac-times34.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}}\right)} - 1\right) \cdot 1 \]
      6. add-sqr-sqrt34.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{d}}{\sqrt{\ell} \cdot \sqrt{h}}\right)} - 1\right) \cdot 1 \]
      7. sqrt-prod28.6%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{d}{\color{blue}{\sqrt{\ell \cdot h}}}\right)} - 1\right) \cdot 1 \]
    9. Applied egg-rr28.6%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1\right)} \cdot 1 \]
    10. Step-by-step derivation
      1. expm1-def40.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \cdot 1 \]
      2. expm1-log1p46.5%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot 1 \]
    11. Simplified46.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7.5 \cdot 10^{-244}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]

Alternative 18: 4.1% accurate, 3.2× speedup?

\[\begin{array}{l} \\ d \cdot \sqrt{\ell \cdot h} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (sqrt (* l h))))
double code(double d, double h, double l, double M, double D) {
	return d * sqrt((l * 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
    code = d * sqrt((l * h))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.sqrt((l * h));
}
def code(d, h, l, M, D):
	return d * math.sqrt((l * h))
function code(d, h, l, M, D)
	return Float64(d * sqrt(Float64(l * h)))
end
function tmp = code(d, h, l, M, D)
	tmp = d * sqrt((l * h));
end
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot \sqrt{\ell \cdot h}
\end{array}
Derivation
  1. Initial program 69.9%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified70.0%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
  3. Step-by-step derivation
    1. frac-2neg70.0%

      \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    2. sqrt-div41.8%

      \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
  4. Applied egg-rr41.8%

    \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
  5. Taylor expanded in d around -inf 27.7%

    \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
  6. Step-by-step derivation
    1. mul-1-neg27.7%

      \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    2. distribute-rgt-neg-in27.7%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
  7. Simplified27.7%

    \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
  8. Taylor expanded in d around 0 27.7%

    \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
  9. Step-by-step derivation
    1. mul-1-neg27.7%

      \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    2. *-commutative27.7%

      \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
    3. unpow1/227.7%

      \[\leadsto -\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
    4. rem-exp-log26.3%

      \[\leadsto -{\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
    5. exp-neg26.3%

      \[\leadsto -{\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
    6. exp-prod26.5%

      \[\leadsto -\color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
    7. distribute-lft-neg-out26.5%

      \[\leadsto -e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot d \]
    8. distribute-rgt-neg-in26.5%

      \[\leadsto -e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot d \]
    9. metadata-eval26.5%

      \[\leadsto -e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot d \]
    10. exp-to-pow27.9%

      \[\leadsto -\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    11. distribute-rgt-neg-in27.9%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]
  10. Simplified27.9%

    \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]
  11. Applied egg-rr2.5%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\ell \cdot h}\right)} - 1} \]
  12. Step-by-step derivation
    1. expm1-def2.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\ell \cdot h}\right)\right)} \]
    2. expm1-log1p3.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\ell \cdot h}} \]
  13. Simplified3.9%

    \[\leadsto \color{blue}{d \cdot \sqrt{\ell \cdot h}} \]
  14. Final simplification3.9%

    \[\leadsto d \cdot \sqrt{\ell \cdot h} \]

Alternative 19: 25.5% accurate, 3.2× speedup?

\[\begin{array}{l} \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
double code(double d, double h, double l, double M, double D) {
	return d / sqrt((l * 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
    code = d / sqrt((l * h))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d / Math.sqrt((l * h));
}
def code(d, h, l, M, D):
	return d / math.sqrt((l * h))
function code(d, h, l, M, D)
	return Float64(d / sqrt(Float64(l * h)))
end
function tmp = code(d, h, l, M, D)
	tmp = d / sqrt((l * h));
end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 69.9%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified68.6%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left({\left(\frac{-0.5 \cdot M}{d} \cdot D\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)} \]
  3. Taylor expanded in M around 0 43.1%

    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{1} \]
  4. Step-by-step derivation
    1. sqrt-div42.0%

      \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
    2. div-inv42.0%

      \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\color{blue}{\left(\sqrt{d} \cdot \frac{1}{\sqrt{\ell}}\right)} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
  5. Applied egg-rr26.0%

    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\left(\sqrt{d} \cdot \frac{1}{\sqrt{\ell}}\right)}\right) \cdot 1 \]
  6. Step-by-step derivation
    1. associate-*r/42.0%

      \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\color{blue}{\frac{\sqrt{d} \cdot 1}{\sqrt{\ell}}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
    2. *-rgt-identity42.0%

      \[\leadsto \frac{\sqrt{d}}{\frac{\sqrt{h}}{\frac{\color{blue}{\sqrt{d}}}{\sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \frac{-0.5 \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
  7. Simplified26.0%

    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}\right) \cdot 1 \]
  8. Step-by-step derivation
    1. expm1-log1p-u25.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\right)} \cdot 1 \]
    2. expm1-udef16.9%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)} - 1\right)} \cdot 1 \]
    3. *-commutative16.9%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \sqrt{\frac{d}{h}}}\right)} - 1\right) \cdot 1 \]
    4. sqrt-div18.8%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}}\right)} - 1\right) \cdot 1 \]
    5. frac-times18.8%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}}\right)} - 1\right) \cdot 1 \]
    6. add-sqr-sqrt18.8%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{d}}{\sqrt{\ell} \cdot \sqrt{h}}\right)} - 1\right) \cdot 1 \]
    7. sqrt-prod16.8%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{d}{\color{blue}{\sqrt{\ell \cdot h}}}\right)} - 1\right) \cdot 1 \]
  9. Applied egg-rr16.8%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1\right)} \cdot 1 \]
  10. Step-by-step derivation
    1. expm1-def23.4%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \cdot 1 \]
    2. expm1-log1p29.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot 1 \]
  11. Simplified29.0%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot 1 \]
  12. Final simplification29.0%

    \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]

Reproduce

?
herbie shell --seed 2023299 
(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)))))