Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.5% → 77.4%
Time: 26.6s
Alternatives: 19
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 66.5% accurate, 1.0× speedup?

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

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

Alternative 1: 77.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{d}{h}}\\ t_2 := \sqrt{-d}\\ t_3 := \sqrt{-h}\\ t_4 := \sqrt{-\ell}\\ \mathbf{if}\;d \leq -3.8 \cdot 10^{+46}:\\ \;\;\;\;\frac{t_2}{t_3} \cdot \left(t_0 \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}\;d \leq -9.6 \cdot 10^{-70}:\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \left(\frac{D}{d} \cdot \frac{t_3}{t_4}\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-279}:\\ \;\;\;\;t_1 \cdot \left(\frac{t_2}{t_4} \cdot \left(1 - 0.5 \cdot {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq 2.15 \cdot 10^{-159}:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{{\left(\frac{\sqrt[3]{\sqrt{h}}}{\sqrt{\ell}}\right)}^{3}}}\\ \mathbf{elif}\;d \leq 1.35 \cdot 10^{+112}:\\ \;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 + -0.125 \cdot {\left(\frac{\sqrt{h} \cdot \left(M \cdot D\right)}{d \cdot \sqrt{\ell}}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l)))
        (t_1 (sqrt (/ d h)))
        (t_2 (sqrt (- d)))
        (t_3 (sqrt (- h)))
        (t_4 (sqrt (- l))))
   (if (<= d -3.8e+46)
     (*
      (/ t_2 t_3)
      (* t_0 (- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))))
     (if (<= d -9.6e-70)
       (*
        t_1
        (*
         t_0
         (- 1.0 (* 0.5 (pow (* (* 0.5 M) (* (/ D d) (/ t_3 t_4))) 2.0)))))
       (if (<= d -4e-279)
         (*
          t_1
          (*
           (/ t_2 t_4)
           (- 1.0 (* 0.5 (pow (* (/ (* D (* 0.5 M)) d) (sqrt (/ h l))) 2.0)))))
         (if (<= d 2.15e-159)
           (*
            -0.125
            (/ (pow (* M D) 2.0) (/ d (pow (/ (cbrt (sqrt h)) (sqrt l)) 3.0))))
           (if (<= d 1.35e+112)
             (*
              (* t_0 t_1)
              (+
               1.0
               (* -0.125 (pow (/ (* (sqrt h) (* M D)) (* d (sqrt l))) 2.0))))
             (*
              (/ d (* (sqrt h) (sqrt l)))
              (-
               1.0
               (* (/ h l) (* 0.5 (pow (* (/ D d) (* 0.5 M)) 2.0))))))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = sqrt((d / h));
	double t_2 = sqrt(-d);
	double t_3 = sqrt(-h);
	double t_4 = sqrt(-l);
	double tmp;
	if (d <= -3.8e+46) {
		tmp = (t_2 / t_3) * (t_0 * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
	} else if (d <= -9.6e-70) {
		tmp = t_1 * (t_0 * (1.0 - (0.5 * pow(((0.5 * M) * ((D / d) * (t_3 / t_4))), 2.0))));
	} else if (d <= -4e-279) {
		tmp = t_1 * ((t_2 / t_4) * (1.0 - (0.5 * pow((((D * (0.5 * M)) / d) * sqrt((h / l))), 2.0))));
	} else if (d <= 2.15e-159) {
		tmp = -0.125 * (pow((M * D), 2.0) / (d / pow((cbrt(sqrt(h)) / sqrt(l)), 3.0)));
	} else if (d <= 1.35e+112) {
		tmp = (t_0 * t_1) * (1.0 + (-0.125 * pow(((sqrt(h) * (M * D)) / (d * sqrt(l))), 2.0)));
	} else {
		tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - ((h / l) * (0.5 * pow(((D / d) * (0.5 * M)), 2.0))));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = Math.sqrt((d / h));
	double t_2 = Math.sqrt(-d);
	double t_3 = Math.sqrt(-h);
	double t_4 = Math.sqrt(-l);
	double tmp;
	if (d <= -3.8e+46) {
		tmp = (t_2 / t_3) * (t_0 * (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
	} else if (d <= -9.6e-70) {
		tmp = t_1 * (t_0 * (1.0 - (0.5 * Math.pow(((0.5 * M) * ((D / d) * (t_3 / t_4))), 2.0))));
	} else if (d <= -4e-279) {
		tmp = t_1 * ((t_2 / t_4) * (1.0 - (0.5 * Math.pow((((D * (0.5 * M)) / d) * Math.sqrt((h / l))), 2.0))));
	} else if (d <= 2.15e-159) {
		tmp = -0.125 * (Math.pow((M * D), 2.0) / (d / Math.pow((Math.cbrt(Math.sqrt(h)) / Math.sqrt(l)), 3.0)));
	} else if (d <= 1.35e+112) {
		tmp = (t_0 * t_1) * (1.0 + (-0.125 * Math.pow(((Math.sqrt(h) * (M * D)) / (d * Math.sqrt(l))), 2.0)));
	} else {
		tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - ((h / l) * (0.5 * Math.pow(((D / d) * (0.5 * M)), 2.0))));
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = sqrt(Float64(d / h))
	t_2 = sqrt(Float64(-d))
	t_3 = sqrt(Float64(-h))
	t_4 = sqrt(Float64(-l))
	tmp = 0.0
	if (d <= -3.8e+46)
		tmp = Float64(Float64(t_2 / t_3) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l))))));
	elseif (d <= -9.6e-70)
		tmp = Float64(t_1 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(Float64(D / d) * Float64(t_3 / t_4))) ^ 2.0)))));
	elseif (d <= -4e-279)
		tmp = Float64(t_1 * Float64(Float64(t_2 / t_4) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(D * Float64(0.5 * M)) / d) * sqrt(Float64(h / l))) ^ 2.0)))));
	elseif (d <= 2.15e-159)
		tmp = Float64(-0.125 * Float64((Float64(M * D) ^ 2.0) / Float64(d / (Float64(cbrt(sqrt(h)) / sqrt(l)) ^ 3.0))));
	elseif (d <= 1.35e+112)
		tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 + Float64(-0.125 * (Float64(Float64(sqrt(h) * Float64(M * D)) / Float64(d * sqrt(l))) ^ 2.0))));
	else
		tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0)))));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[(-h)], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[(-l)], $MachinePrecision]}, If[LessEqual[d, -3.8e+46], N[(N[(t$95$2 / t$95$3), $MachinePrecision] * N[(t$95$0 * 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[d, -9.6e-70], N[(t$95$1 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(t$95$3 / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-279], N[(t$95$1 * N[(N[(t$95$2 / t$95$4), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.15e-159], N[(-0.125 * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / N[(d / N[Power[N[(N[Power[N[Sqrt[h], $MachinePrecision], 1/3], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.35e+112], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[Power[N[(N[(N[Sqrt[h], $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(d * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{-d}\\
t_3 := \sqrt{-h}\\
t_4 := \sqrt{-\ell}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{+46}:\\
\;\;\;\;\frac{t_2}{t_3} \cdot \left(t_0 \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}\;d \leq -9.6 \cdot 10^{-70}:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \left(\frac{D}{d} \cdot \frac{t_3}{t_4}\right)\right)}^{2}\right)\right)\\

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

\mathbf{elif}\;d \leq 2.15 \cdot 10^{-159}:\\
\;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{{\left(\frac{\sqrt[3]{\sqrt{h}}}{\sqrt{\ell}}\right)}^{3}}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if d < -3.7999999999999999e46

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

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

        \[\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-div87.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-rr87.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) \]

    if -3.7999999999999999e46 < d < -9.6000000000000005e-70

    1. Initial program 79.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. Simplified79.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.6000000000000005e-70 < d < -4.00000000000000022e-279

    1. Initial program 36.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. Simplified36.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000022e-279 < d < 2.15e-159

    1. Initial program 20.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. Simplified20.1%

      \[\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. Step-by-step derivation
      1. fma-udef20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.15e-159 < d < 1.3500000000000001e112

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

      \[\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 62.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3500000000000001e112 < d

    1. Initial program 71.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.8 \cdot 10^{+46}:\\ \;\;\;\;\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)\\ \mathbf{elif}\;d \leq -9.6 \cdot 10^{-70}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \left(\frac{D}{d} \cdot \frac{\sqrt{-h}}{\sqrt{-\ell}}\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -4 \cdot 10^{-279}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq 2.15 \cdot 10^{-159}:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{{\left(\frac{\sqrt[3]{\sqrt{h}}}{\sqrt{\ell}}\right)}^{3}}}\\ \mathbf{elif}\;d \leq 1.35 \cdot 10^{+112}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + -0.125 \cdot {\left(\frac{\sqrt{h} \cdot \left(M \cdot D\right)}{d \cdot \sqrt{\ell}}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)\right)\\ \end{array} \]

Alternative 2: 78.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\ t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ t_3 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\ \;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\ \;\;\;\;\left(t_0 \cdot t_3\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{{\left(\frac{\sqrt[3]{\sqrt{h}}}{\sqrt{\ell}}\right)}^{3}}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l)))
        (t_1
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
        (t_2 (fabs (* d (pow (* h l) -0.5))))
        (t_3 (sqrt (/ d h))))
   (if (<= t_1 -4e+15)
     (*
      t_3
      (*
       t_0
       (- 1.0 (* 0.5 (pow (* (/ (* D (* 0.5 M)) d) (sqrt (/ h l))) 2.0)))))
     (if (<= t_1 0.0)
       t_2
       (if (<= t_1 2e+253)
         (*
          (* t_0 t_3)
          (+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
         (if (<= t_1 INFINITY)
           t_2
           (*
            -0.125
            (/
             (pow (* M D) 2.0)
             (/ d (pow (/ (cbrt (sqrt h)) (sqrt l)) 3.0))))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = fabs((d * pow((h * l), -0.5)));
	double t_3 = sqrt((d / h));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 - (0.5 * pow((((D * (0.5 * M)) / d) * sqrt((h / l))), 2.0))));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_0 * t_3) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = -0.125 * (pow((M * D), 2.0) / (d / pow((cbrt(sqrt(h)) / sqrt(l)), 3.0)));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
	double t_3 = Math.sqrt((d / h));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 - (0.5 * Math.pow((((D * (0.5 * M)) / d) * Math.sqrt((h / l))), 2.0))));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_0 * t_3) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else {
		tmp = -0.125 * (Math.pow((M * D), 2.0) / (d / Math.pow((Math.cbrt(Math.sqrt(h)) / Math.sqrt(l)), 3.0)));
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))
	t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5)))
	t_3 = sqrt(Float64(d / h))
	tmp = 0.0
	if (t_1 <= -4e+15)
		tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(D * Float64(0.5 * M)) / d) * sqrt(Float64(h / l))) ^ 2.0)))));
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 2e+253)
		tmp = Float64(Float64(t_0 * t_3) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5))));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(-0.125 * Float64((Float64(M * D) ^ 2.0) / Float64(d / (Float64(cbrt(sqrt(h)) / sqrt(l)) ^ 3.0))));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$0 * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / N[(d / N[Power[N[(N[Power[N[Sqrt[h], $MachinePrecision], 1/3], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{{\left(\frac{\sqrt[3]{\sqrt{h}}}{\sqrt{\ell}}\right)}^{3}}}\\


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

    1. Initial program 78.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. Simplified79.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. add-sqr-sqrt79.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4e15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 1.9999999999999999e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0

    1. Initial program 48.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. Simplified48.2%

      \[\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 d around inf 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 1.9999999999999999e253

    1. Initial program 98.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. Simplified96.8%

      \[\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. Step-by-step derivation
      1. fma-udef96.8%

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 76.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\ t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ t_3 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\ \;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 + \frac{h \cdot \left({\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2} \cdot -0.5\right)}{\ell}\right)\right)\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\ \;\;\;\;\left(t_3 \cdot t_0\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d h)))
        (t_1
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
        (t_2 (fabs (* d (pow (* h l) -0.5))))
        (t_3 (sqrt (/ d l))))
   (if (<= t_1 -4e+15)
     (*
      t_3
      (* t_0 (+ 1.0 (/ (* h (* (pow (* (/ D d) (* 0.5 M)) 2.0) -0.5)) l))))
     (if (<= t_1 0.0)
       t_2
       (if (<= t_1 2e+253)
         (*
          (* t_3 t_0)
          (+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
         (if (<= t_1 INFINITY)
           t_2
           (*
            -0.125
            (pow (/ (* M D) (sqrt (/ d (/ (sqrt h) (pow l 1.5))))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h));
	double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = fabs((d * pow((h * l), -0.5)));
	double t_3 = sqrt((d / l));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 + ((h * (pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_3 * t_0) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = -0.125 * pow(((M * D) / sqrt((d / (sqrt(h) / pow(l, 1.5))))), 2.0);
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h));
	double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
	double t_3 = Math.sqrt((d / l));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 + ((h * (Math.pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_3 * t_0) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else {
		tmp = -0.125 * Math.pow(((M * D) / Math.sqrt((d / (Math.sqrt(h) / Math.pow(l, 1.5))))), 2.0);
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0))))
	t_2 = math.fabs((d * math.pow((h * l), -0.5)))
	t_3 = math.sqrt((d / l))
	tmp = 0
	if t_1 <= -4e+15:
		tmp = t_3 * (t_0 * (1.0 + ((h * (math.pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)))
	elif t_1 <= 0.0:
		tmp = t_2
	elif t_1 <= 2e+253:
		tmp = (t_3 * t_0) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)))
	elif t_1 <= math.inf:
		tmp = t_2
	else:
		tmp = -0.125 * math.pow(((M * D) / math.sqrt((d / (math.sqrt(h) / math.pow(l, 1.5))))), 2.0)
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))
	t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5)))
	t_3 = sqrt(Float64(d / l))
	tmp = 0.0
	if (t_1 <= -4e+15)
		tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0) * -0.5)) / l))));
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 2e+253)
		tmp = Float64(Float64(t_3 * t_0) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5))));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(-0.125 * (Float64(Float64(M * D) / sqrt(Float64(d / Float64(sqrt(h) / (l ^ 1.5))))) ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
	t_2 = abs((d * ((h * l) ^ -0.5)));
	t_3 = sqrt((d / l));
	tmp = 0.0;
	if (t_1 <= -4e+15)
		tmp = t_3 * (t_0 * (1.0 + ((h * ((((D / d) * (0.5 * M)) ^ 2.0) * -0.5)) / l)));
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 2e+253)
		tmp = (t_3 * t_0) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5)));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = -0.125 * (((M * D) / sqrt((d / (sqrt(h) / (l ^ 1.5))))) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$3 * t$95$0), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / N[Sqrt[N[(d / N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\

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


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

    1. Initial program 78.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. Simplified79.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. Step-by-step derivation
      1. associate-*l/79.7%

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

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \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)}{\ell}\right)\right) \]
      3. add-sqr-sqrt79.7%

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

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

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

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

    if -4e15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 1.9999999999999999e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0

    1. Initial program 48.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. Simplified48.2%

      \[\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 d around inf 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 1.9999999999999999e253

    1. Initial program 98.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. Simplified96.8%

      \[\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. Step-by-step derivation
      1. fma-udef96.8%

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq -4 \cdot 10^{+15}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left({\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2} \cdot -0.5\right)}{\ell}\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 0:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 2 \cdot 10^{+253}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\ \end{array} \]

Alternative 4: 77.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\ t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ t_3 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\ \;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \left(\frac{D}{d} \cdot \sqrt{\frac{h}{\ell}}\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\ \;\;\;\;\left(t_0 \cdot t_3\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l)))
        (t_1
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
        (t_2 (fabs (* d (pow (* h l) -0.5))))
        (t_3 (sqrt (/ d h))))
   (if (<= t_1 -4e+15)
     (*
      t_3
      (*
       t_0
       (- 1.0 (* 0.5 (pow (* (* 0.5 M) (* (/ D d) (sqrt (/ h l)))) 2.0)))))
     (if (<= t_1 0.0)
       t_2
       (if (<= t_1 2e+253)
         (*
          (* t_0 t_3)
          (+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
         (if (<= t_1 INFINITY)
           t_2
           (*
            -0.125
            (pow (/ (* M D) (sqrt (/ d (/ (sqrt h) (pow l 1.5))))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = fabs((d * pow((h * l), -0.5)));
	double t_3 = sqrt((d / h));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 - (0.5 * pow(((0.5 * M) * ((D / d) * sqrt((h / l)))), 2.0))));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_0 * t_3) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = -0.125 * pow(((M * D) / sqrt((d / (sqrt(h) / pow(l, 1.5))))), 2.0);
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
	double t_3 = Math.sqrt((d / h));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 - (0.5 * Math.pow(((0.5 * M) * ((D / d) * Math.sqrt((h / l)))), 2.0))));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_0 * t_3) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else {
		tmp = -0.125 * Math.pow(((M * D) / Math.sqrt((d / (Math.sqrt(h) / Math.pow(l, 1.5))))), 2.0);
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0))))
	t_2 = math.fabs((d * math.pow((h * l), -0.5)))
	t_3 = math.sqrt((d / h))
	tmp = 0
	if t_1 <= -4e+15:
		tmp = t_3 * (t_0 * (1.0 - (0.5 * math.pow(((0.5 * M) * ((D / d) * math.sqrt((h / l)))), 2.0))))
	elif t_1 <= 0.0:
		tmp = t_2
	elif t_1 <= 2e+253:
		tmp = (t_0 * t_3) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)))
	elif t_1 <= math.inf:
		tmp = t_2
	else:
		tmp = -0.125 * math.pow(((M * D) / math.sqrt((d / (math.sqrt(h) / math.pow(l, 1.5))))), 2.0)
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))
	t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5)))
	t_3 = sqrt(Float64(d / h))
	tmp = 0.0
	if (t_1 <= -4e+15)
		tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(Float64(D / d) * sqrt(Float64(h / l)))) ^ 2.0)))));
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 2e+253)
		tmp = Float64(Float64(t_0 * t_3) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5))));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(-0.125 * (Float64(Float64(M * D) / sqrt(Float64(d / Float64(sqrt(h) / (l ^ 1.5))))) ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / l));
	t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
	t_2 = abs((d * ((h * l) ^ -0.5)));
	t_3 = sqrt((d / h));
	tmp = 0.0;
	if (t_1 <= -4e+15)
		tmp = t_3 * (t_0 * (1.0 - (0.5 * (((0.5 * M) * ((D / d) * sqrt((h / l)))) ^ 2.0))));
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 2e+253)
		tmp = (t_0 * t_3) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5)));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = -0.125 * (((M * D) / sqrt((d / (sqrt(h) / (l ^ 1.5))))) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$0 * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / N[Sqrt[N[(d / N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\

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


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

    1. Initial program 78.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. Simplified79.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. add-sqr-sqrt79.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4e15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 1.9999999999999999e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0

    1. Initial program 48.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. Simplified48.2%

      \[\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 d around inf 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 1.9999999999999999e253

    1. Initial program 98.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. Simplified96.8%

      \[\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. Step-by-step derivation
      1. fma-udef96.8%

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq -4 \cdot 10^{+15}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \left(\frac{D}{d} \cdot \sqrt{\frac{h}{\ell}}\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 0:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 2 \cdot 10^{+253}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\ \end{array} \]

Alternative 5: 77.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\ t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ t_3 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\ \;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\sqrt{\frac{h}{\ell}} \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\ \;\;\;\;\left(t_0 \cdot t_3\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l)))
        (t_1
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
        (t_2 (fabs (* d (pow (* h l) -0.5))))
        (t_3 (sqrt (/ d h))))
   (if (<= t_1 -4e+15)
     (*
      t_3
      (*
       t_0
       (- 1.0 (* 0.5 (pow (* (sqrt (/ h l)) (* (/ D d) (* 0.5 M))) 2.0)))))
     (if (<= t_1 0.0)
       t_2
       (if (<= t_1 2e+253)
         (*
          (* t_0 t_3)
          (+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
         (if (<= t_1 INFINITY)
           t_2
           (*
            -0.125
            (pow (/ (* M D) (sqrt (/ d (/ (sqrt h) (pow l 1.5))))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = fabs((d * pow((h * l), -0.5)));
	double t_3 = sqrt((d / h));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 - (0.5 * pow((sqrt((h / l)) * ((D / d) * (0.5 * M))), 2.0))));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_0 * t_3) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = -0.125 * pow(((M * D) / sqrt((d / (sqrt(h) / pow(l, 1.5))))), 2.0);
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
	double t_3 = Math.sqrt((d / h));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 - (0.5 * Math.pow((Math.sqrt((h / l)) * ((D / d) * (0.5 * M))), 2.0))));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_0 * t_3) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else {
		tmp = -0.125 * Math.pow(((M * D) / Math.sqrt((d / (Math.sqrt(h) / Math.pow(l, 1.5))))), 2.0);
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0))))
	t_2 = math.fabs((d * math.pow((h * l), -0.5)))
	t_3 = math.sqrt((d / h))
	tmp = 0
	if t_1 <= -4e+15:
		tmp = t_3 * (t_0 * (1.0 - (0.5 * math.pow((math.sqrt((h / l)) * ((D / d) * (0.5 * M))), 2.0))))
	elif t_1 <= 0.0:
		tmp = t_2
	elif t_1 <= 2e+253:
		tmp = (t_0 * t_3) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)))
	elif t_1 <= math.inf:
		tmp = t_2
	else:
		tmp = -0.125 * math.pow(((M * D) / math.sqrt((d / (math.sqrt(h) / math.pow(l, 1.5))))), 2.0)
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))
	t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5)))
	t_3 = sqrt(Float64(d / h))
	tmp = 0.0
	if (t_1 <= -4e+15)
		tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(sqrt(Float64(h / l)) * Float64(Float64(D / d) * Float64(0.5 * M))) ^ 2.0)))));
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 2e+253)
		tmp = Float64(Float64(t_0 * t_3) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5))));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(-0.125 * (Float64(Float64(M * D) / sqrt(Float64(d / Float64(sqrt(h) / (l ^ 1.5))))) ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / l));
	t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
	t_2 = abs((d * ((h * l) ^ -0.5)));
	t_3 = sqrt((d / h));
	tmp = 0.0;
	if (t_1 <= -4e+15)
		tmp = t_3 * (t_0 * (1.0 - (0.5 * ((sqrt((h / l)) * ((D / d) * (0.5 * M))) ^ 2.0))));
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 2e+253)
		tmp = (t_0 * t_3) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5)));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = -0.125 * (((M * D) / sqrt((d / (sqrt(h) / (l ^ 1.5))))) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$0 * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / N[Sqrt[N[(d / N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\

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


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

    1. Initial program 78.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. Simplified79.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. add-sqr-sqrt79.7%

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

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

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

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

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

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

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

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

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

    if -4e15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 1.9999999999999999e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0

    1. Initial program 48.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. Simplified48.2%

      \[\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 d around inf 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 1.9999999999999999e253

    1. Initial program 98.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. Simplified96.8%

      \[\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. Step-by-step derivation
      1. fma-udef96.8%

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq -4 \cdot 10^{+15}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot {\left(\sqrt{\frac{h}{\ell}} \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 0:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 2 \cdot 10^{+253}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\ \end{array} \]

Alternative 6: 77.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\ t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ t_3 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\ \;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\ \;\;\;\;\left(t_0 \cdot t_3\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l)))
        (t_1
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
        (t_2 (fabs (* d (pow (* h l) -0.5))))
        (t_3 (sqrt (/ d h))))
   (if (<= t_1 -4e+15)
     (*
      t_3
      (*
       t_0
       (- 1.0 (* 0.5 (pow (* (/ (* D (* 0.5 M)) d) (sqrt (/ h l))) 2.0)))))
     (if (<= t_1 0.0)
       t_2
       (if (<= t_1 2e+253)
         (*
          (* t_0 t_3)
          (+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
         (if (<= t_1 INFINITY)
           t_2
           (*
            -0.125
            (pow (/ (* M D) (sqrt (/ d (/ (sqrt h) (pow l 1.5))))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = fabs((d * pow((h * l), -0.5)));
	double t_3 = sqrt((d / h));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 - (0.5 * pow((((D * (0.5 * M)) / d) * sqrt((h / l))), 2.0))));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_0 * t_3) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = -0.125 * pow(((M * D) / sqrt((d / (sqrt(h) / pow(l, 1.5))))), 2.0);
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
	double t_3 = Math.sqrt((d / h));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_3 * (t_0 * (1.0 - (0.5 * Math.pow((((D * (0.5 * M)) / d) * Math.sqrt((h / l))), 2.0))));
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 2e+253) {
		tmp = (t_0 * t_3) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else {
		tmp = -0.125 * Math.pow(((M * D) / Math.sqrt((d / (Math.sqrt(h) / Math.pow(l, 1.5))))), 2.0);
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0))))
	t_2 = math.fabs((d * math.pow((h * l), -0.5)))
	t_3 = math.sqrt((d / h))
	tmp = 0
	if t_1 <= -4e+15:
		tmp = t_3 * (t_0 * (1.0 - (0.5 * math.pow((((D * (0.5 * M)) / d) * math.sqrt((h / l))), 2.0))))
	elif t_1 <= 0.0:
		tmp = t_2
	elif t_1 <= 2e+253:
		tmp = (t_0 * t_3) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)))
	elif t_1 <= math.inf:
		tmp = t_2
	else:
		tmp = -0.125 * math.pow(((M * D) / math.sqrt((d / (math.sqrt(h) / math.pow(l, 1.5))))), 2.0)
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))
	t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5)))
	t_3 = sqrt(Float64(d / h))
	tmp = 0.0
	if (t_1 <= -4e+15)
		tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(D * Float64(0.5 * M)) / d) * sqrt(Float64(h / l))) ^ 2.0)))));
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 2e+253)
		tmp = Float64(Float64(t_0 * t_3) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5))));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(-0.125 * (Float64(Float64(M * D) / sqrt(Float64(d / Float64(sqrt(h) / (l ^ 1.5))))) ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / l));
	t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
	t_2 = abs((d * ((h * l) ^ -0.5)));
	t_3 = sqrt((d / h));
	tmp = 0.0;
	if (t_1 <= -4e+15)
		tmp = t_3 * (t_0 * (1.0 - (0.5 * ((((D * (0.5 * M)) / d) * sqrt((h / l))) ^ 2.0))));
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 2e+253)
		tmp = (t_0 * t_3) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5)));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = -0.125 * (((M * D) / sqrt((d / (sqrt(h) / (l ^ 1.5))))) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$0 * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / N[Sqrt[N[(d / N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\

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


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

    1. Initial program 78.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. Simplified79.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. add-sqr-sqrt79.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4e15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 1.9999999999999999e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0

    1. Initial program 48.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. Simplified48.2%

      \[\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 d around inf 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 1.9999999999999999e253

    1. Initial program 98.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. Simplified96.8%

      \[\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. Step-by-step derivation
      1. fma-udef96.8%

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq -4 \cdot 10^{+15}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 0:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 2 \cdot 10^{+253}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\ \end{array} \]

Alternative 7: 76.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\ t_2 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\ \;\;\;\;t_2 \cdot \left(t_0 \cdot \left(1 + \frac{h \cdot \left({\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2} \cdot -0.5\right)}{\ell}\right)\right)\\ \mathbf{elif}\;t_1 \leq 0 \lor \neg \left(t_1 \leq 2 \cdot 10^{+253}\right):\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(t_2 \cdot t_0\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d h)))
        (t_1
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
        (t_2 (sqrt (/ d l))))
   (if (<= t_1 -4e+15)
     (*
      t_2
      (* t_0 (+ 1.0 (/ (* h (* (pow (* (/ D d) (* 0.5 M)) 2.0) -0.5)) l))))
     (if (or (<= t_1 0.0) (not (<= t_1 2e+253)))
       (fabs (* d (pow (* h l) -0.5)))
       (*
        (* t_2 t_0)
        (+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h));
	double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = sqrt((d / l));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_2 * (t_0 * (1.0 + ((h * (pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)));
	} else if ((t_1 <= 0.0) || !(t_1 <= 2e+253)) {
		tmp = fabs((d * pow((h * l), -0.5)));
	} else {
		tmp = (t_2 * t_0) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = sqrt((d / h))
    t_1 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
    t_2 = sqrt((d / l))
    if (t_1 <= (-4d+15)) then
        tmp = t_2 * (t_0 * (1.0d0 + ((h * ((((d_1 / d) * (0.5d0 * m)) ** 2.0d0) * (-0.5d0))) / l)))
    else if ((t_1 <= 0.0d0) .or. (.not. (t_1 <= 2d+253))) then
        tmp = abs((d * ((h * l) ** (-0.5d0))))
    else
        tmp = (t_2 * t_0) * (1.0d0 + (((d_1 * ((-0.5d0) * (m / d))) ** 2.0d0) * ((h / l) * (-0.5d0))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h));
	double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
	double t_2 = Math.sqrt((d / l));
	double tmp;
	if (t_1 <= -4e+15) {
		tmp = t_2 * (t_0 * (1.0 + ((h * (Math.pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)));
	} else if ((t_1 <= 0.0) || !(t_1 <= 2e+253)) {
		tmp = Math.abs((d * Math.pow((h * l), -0.5)));
	} else {
		tmp = (t_2 * t_0) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0))))
	t_2 = math.sqrt((d / l))
	tmp = 0
	if t_1 <= -4e+15:
		tmp = t_2 * (t_0 * (1.0 + ((h * (math.pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)))
	elif (t_1 <= 0.0) or not (t_1 <= 2e+253):
		tmp = math.fabs((d * math.pow((h * l), -0.5)))
	else:
		tmp = (t_2 * t_0) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)))
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))
	t_2 = sqrt(Float64(d / l))
	tmp = 0.0
	if (t_1 <= -4e+15)
		tmp = Float64(t_2 * Float64(t_0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0) * -0.5)) / l))));
	elseif ((t_1 <= 0.0) || !(t_1 <= 2e+253))
		tmp = abs(Float64(d * (Float64(h * l) ^ -0.5)));
	else
		tmp = Float64(Float64(t_2 * t_0) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
	t_2 = sqrt((d / l));
	tmp = 0.0;
	if (t_1 <= -4e+15)
		tmp = t_2 * (t_0 * (1.0 + ((h * ((((D / d) * (0.5 * M)) ^ 2.0) * -0.5)) / l)));
	elseif ((t_1 <= 0.0) || ~((t_1 <= 2e+253)))
		tmp = abs((d * ((h * l) ^ -0.5)));
	else
		tmp = (t_2 * t_0) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$2 * N[(t$95$0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, 0.0], N[Not[LessEqual[t$95$1, 2e+253]], $MachinePrecision]], N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$2 * t$95$0), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t_1 \leq 0 \lor \neg \left(t_1 \leq 2 \cdot 10^{+253}\right):\\
\;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\

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


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

    1. Initial program 78.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. Simplified79.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. Step-by-step derivation
      1. associate-*l/79.7%

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

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \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)}{\ell}\right)\right) \]
      3. add-sqr-sqrt79.7%

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

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

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

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

    if -4e15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 1.9999999999999999e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l))))

    1. Initial program 24.4%

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

      \[\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 d around inf 35.3%

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 1.9999999999999999e253

    1. Initial program 98.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. Simplified96.8%

      \[\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. Step-by-step derivation
      1. fma-udef96.8%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq -4 \cdot 10^{+15}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left({\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2} \cdot -0.5\right)}{\ell}\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 0 \lor \neg \left(\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 2 \cdot 10^{+253}\right):\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\ \end{array} \]

Alternative 8: 59.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\

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

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


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

    1. Initial program 65.1%

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

      \[\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 d around inf 8.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d < 8.0000000000000002e-99

    1. Initial program 35.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. Simplified35.3%

      \[\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. Step-by-step derivation
      1. fma-udef35.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.0000000000000002e-99 < d

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 65.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -4 \cdot 10^{-279}:\\ \;\;\;\;\mathsf{fma}\left({\left(\frac{M}{d} \cdot \left(D \cdot -0.5\right)\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;d \leq 2.15 \cdot 10^{-97}:\\ \;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -4e-279)
   (*
    (fma (pow (* (/ M d) (* D -0.5)) 2.0) (* (/ h l) -0.5) 1.0)
    (sqrt (* (/ d l) (/ d h))))
   (if (<= d 2.15e-97)
     (* -0.125 (* (/ (sqrt h) (pow l 1.5)) (/ (pow (* M D) 2.0) d)))
     (*
      (/ (/ d (sqrt l)) (sqrt h))
      (- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -4e-279) {
		tmp = fma(pow(((M / d) * (D * -0.5)), 2.0), ((h / l) * -0.5), 1.0) * sqrt(((d / l) * (d / h)));
	} else if (d <= 2.15e-97) {
		tmp = -0.125 * ((sqrt(h) / pow(l, 1.5)) * (pow((M * D), 2.0) / d));
	} else {
		tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
	}
	return tmp;
}
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -4e-279)
		tmp = Float64(fma((Float64(Float64(M / d) * Float64(D * -0.5)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	elseif (d <= 2.15e-97)
		tmp = Float64(-0.125 * Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64((Float64(M * D) ^ 2.0) / d)));
	else
		tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0)))));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -4e-279], N[(N[(N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * -0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.15e-97], N[(-0.125 * N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 67.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000022e-279 < d < 2.15e-97

    1. Initial program 32.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. Simplified32.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. Step-by-step derivation
      1. fma-udef32.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.15e-97 < d

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 70.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -4 \cdot 10^{-279}:\\
\;\;\;\;\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) \cdot \sqrt{\frac{d}{h}}\\

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

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


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

    1. Initial program 67.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.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)} \]

    if -4.00000000000000022e-279 < d < 4.29999999999999988e-98

    1. Initial program 32.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. Simplified32.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. Step-by-step derivation
      1. fma-udef32.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.29999999999999988e-98 < d

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4 \cdot 10^{-279}:\\ \;\;\;\;\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) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;d \leq 4.3 \cdot 10^{-98}:\\ \;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\ \end{array} \]

Alternative 11: 70.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -4 \cdot 10^{-279}:\\
\;\;\;\;\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)\\

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

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


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

    1. Initial program 67.4%

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

      \[\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)} \]

    if -4.00000000000000022e-279 < d < 8.0000000000000002e-99

    1. Initial program 32.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. Simplified32.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. Step-by-step derivation
      1. fma-udef32.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.0000000000000002e-99 < d

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4 \cdot 10^{-279}:\\ \;\;\;\;\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)\\ \mathbf{elif}\;d \leq 8 \cdot 10^{-99}:\\ \;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\ \end{array} \]

Alternative 12: 71.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 67.4%

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

      \[\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. Step-by-step derivation
      1. *-commutative67.4%

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

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

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

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

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

    if -4.00000000000000022e-279 < d < 8.0000000000000002e-99

    1. Initial program 32.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. Simplified32.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. Step-by-step derivation
      1. fma-udef32.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.0000000000000002e-99 < d

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

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

Alternative 13: 50.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
t_1 := {\left(M \cdot D\right)}^{2}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|t_0\right|\\

\mathbf{elif}\;d \leq 3 \cdot 10^{-271}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{t_1}{d}\right)\\

\mathbf{elif}\;d \leq 1.4 \cdot 10^{-259}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq 5.4 \cdot 10^{+55}:\\
\;\;\;\;-0.125 \cdot \left(t_1 \cdot \frac{\frac{\sqrt{h}}{d}}{{\ell}^{1.5}}\right)\\

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


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

    1. Initial program 65.1%

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

      \[\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 d around inf 8.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d < 3.00000000000000002e-271

    1. Initial program 25.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. Simplified25.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. Step-by-step derivation
      1. fma-udef25.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.00000000000000002e-271 < d < 1.4e-259

    1. Initial program 18.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. Simplified18.3%

      \[\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. Step-by-step derivation
      1. fma-udef18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-259 < d < 5.39999999999999954e55

    1. Initial program 55.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. Simplified55.1%

      \[\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. Step-by-step derivation
      1. fma-udef55.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.39999999999999954e55 < d

    1. Initial program 72.2%

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

      \[\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 d around inf 74.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{elif}\;d \leq 3 \cdot 10^{-271}:\\ \;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\ \mathbf{elif}\;d \leq 1.4 \cdot 10^{-259}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{elif}\;d \leq 5.4 \cdot 10^{+55}:\\ \;\;\;\;-0.125 \cdot \left({\left(M \cdot D\right)}^{2} \cdot \frac{\frac{\sqrt{h}}{d}}{{\ell}^{1.5}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 14: 51.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\

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

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


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

    1. Initial program 65.1%

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

      \[\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 d around inf 8.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d < 5.39999999999999954e55

    1. Initial program 49.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. Simplified49.8%

      \[\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. Step-by-step derivation
      1. fma-udef49.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.39999999999999954e55 < d

    1. Initial program 72.2%

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

      \[\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 d around inf 74.3%

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

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

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

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

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

Alternative 15: 46.7% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.65 \cdot 10^{-159}:\\
\;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\

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


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

    1. Initial program 54.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. Simplified54.1%

      \[\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 d around inf 11.0%

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

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

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

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

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

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

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

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

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

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

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

    if 1.6500000000000001e-159 < d

    1. Initial program 72.2%

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

      \[\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. Step-by-step derivation
      1. fma-udef73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 42.7% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;M \leq 3 \cdot 10^{+77}:\\
\;\;\;\;\left|t_0\right|\\

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


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

    1. Initial program 58.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. Simplified58.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 d around inf 29.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt27.5%

        \[\leadsto \color{blue}{\sqrt{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \cdot \sqrt{d \cdot \sqrt{\frac{1}{h \cdot \ell}}}} \]
      2. sqrt-unprod33.8%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)}} \]
      3. pow233.8%

        \[\leadsto \sqrt{\color{blue}{{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)}^{2}}} \]
      4. inv-pow33.8%

        \[\leadsto \sqrt{{\left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right)}^{2}} \]
      5. sqrt-pow133.8%

        \[\leadsto \sqrt{{\left(d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right)}^{2}} \]
      6. metadata-eval33.8%

        \[\leadsto \sqrt{{\left(d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right)}^{2}} \]
    5. Applied egg-rr33.8%

      \[\leadsto \color{blue}{\sqrt{{\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)}^{2}}} \]
    6. Step-by-step derivation
      1. unpow233.8%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)}} \]
      2. rem-sqrt-square49.4%

        \[\leadsto \color{blue}{\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|} \]
    7. Simplified49.4%

      \[\leadsto \color{blue}{\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|} \]

    if 2.9999999999999998e77 < M

    1. Initial program 75.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified75.2%

      \[\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. Step-by-step derivation
      1. fma-udef75.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left({\left(\frac{-0.5 \cdot M}{d} \cdot D\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right)} \]
      2. *-commutative75.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\color{blue}{\left(D \cdot \frac{-0.5 \cdot M}{d}\right)}}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right) \]
      3. *-un-lft-identity75.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\left(D \cdot \frac{-0.5 \cdot M}{\color{blue}{1 \cdot d}}\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right) \]
      4. times-frac75.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\left(D \cdot \color{blue}{\left(\frac{-0.5}{1} \cdot \frac{M}{d}\right)}\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right) \]
      5. metadata-eval75.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\left(D \cdot \left(\color{blue}{-0.5} \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right) \]
      6. *-commutative75.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \color{blue}{\left(\frac{h}{\ell} \cdot -0.5\right)} + 1\right) \]
    4. Applied egg-rr75.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left({\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + 1\right)} \]
    5. Taylor expanded in d around inf 22.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. unpow1/222.6%

        \[\leadsto d \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \]
      2. rem-exp-log22.3%

        \[\leadsto d \cdot {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \]
      3. exp-neg22.3%

        \[\leadsto d \cdot {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \]
      4. exp-prod22.3%

        \[\leadsto d \cdot \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \]
      5. distribute-lft-neg-out22.3%

        \[\leadsto d \cdot e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \]
      6. distribute-rgt-neg-in22.3%

        \[\leadsto d \cdot e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \]
      7. metadata-eval22.3%

        \[\leadsto d \cdot e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \]
      8. exp-to-pow22.6%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    7. Simplified22.6%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 3 \cdot 10^{+77}:\\ \;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \]

Alternative 17: 27.5% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;h \leq -4 \cdot 10^{+127}:\\ \;\;\;\;d \cdot \sqrt{h \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= h -4e+127) (* d (sqrt (* h l))) (* d (sqrt (/ (/ 1.0 l) h)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -4e+127) {
		tmp = d * sqrt((h * l));
	} 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 (h <= (-4d+127)) then
        tmp = d * sqrt((h * l))
    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 (h <= -4e+127) {
		tmp = d * Math.sqrt((h * l));
	} else {
		tmp = d * Math.sqrt(((1.0 / l) / h));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if h <= -4e+127:
		tmp = d * math.sqrt((h * l))
	else:
		tmp = d * math.sqrt(((1.0 / l) / h))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (h <= -4e+127)
		tmp = Float64(d * sqrt(Float64(h * l)));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (h <= -4e+127)
		tmp = d * sqrt((h * l));
	else
		tmp = d * sqrt(((1.0 / l) / h));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -4e+127], N[(d * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;h \leq -4 \cdot 10^{+127}:\\
\;\;\;\;d \cdot \sqrt{h \cdot \ell}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < -3.99999999999999982e127

    1. Initial program 53.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified53.4%

      \[\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 d around inf 3.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. add-exp-log3.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{e^{\log \left(\frac{1}{h \cdot \ell}\right)}}} \]
      2. log-rec3.4%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{-\log \left(h \cdot \ell\right)}}} \]
    5. Applied egg-rr3.4%

      \[\leadsto d \cdot \sqrt{\color{blue}{e^{-\log \left(h \cdot \ell\right)}}} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt0.5%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{\sqrt{-\log \left(h \cdot \ell\right)} \cdot \sqrt{-\log \left(h \cdot \ell\right)}}}} \]
      2. sqrt-unprod16.5%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{\sqrt{\left(-\log \left(h \cdot \ell\right)\right) \cdot \left(-\log \left(h \cdot \ell\right)\right)}}}} \]
      3. sqr-neg16.5%

        \[\leadsto d \cdot \sqrt{e^{\sqrt{\color{blue}{\log \left(h \cdot \ell\right) \cdot \log \left(h \cdot \ell\right)}}}} \]
      4. sqrt-unprod16.0%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{\sqrt{\log \left(h \cdot \ell\right)} \cdot \sqrt{\log \left(h \cdot \ell\right)}}}} \]
      5. add-sqr-sqrt16.5%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{\log \left(h \cdot \ell\right)}}} \]
      6. *-commutative16.5%

        \[\leadsto d \cdot \sqrt{e^{\log \color{blue}{\left(\ell \cdot h\right)}}} \]
      7. add-exp-log16.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\ell \cdot h}} \]
    7. Applied egg-rr16.5%

      \[\leadsto d \cdot \sqrt{\color{blue}{\ell \cdot h}} \]

    if -3.99999999999999982e127 < h

    1. Initial program 63.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified63.4%

      \[\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 d around inf 32.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. *-commutative32.2%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      2. associate-/r*32.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    5. Simplified32.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -4 \cdot 10^{+127}:\\ \;\;\;\;d \cdot \sqrt{h \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]

Alternative 18: 27.3% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;h \leq -1.35 \cdot 10^{+127}:\\ \;\;\;\;d \cdot \sqrt{h \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= h -1.35e+127) (* d (sqrt (* h l))) (* d (pow (* h l) -0.5))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -1.35e+127) {
		tmp = d * sqrt((h * l));
	} else {
		tmp = d * pow((h * l), -0.5);
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (h <= (-1.35d+127)) then
        tmp = d * sqrt((h * l))
    else
        tmp = d * ((h * l) ** (-0.5d0))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -1.35e+127) {
		tmp = d * Math.sqrt((h * l));
	} else {
		tmp = d * Math.pow((h * l), -0.5);
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if h <= -1.35e+127:
		tmp = d * math.sqrt((h * l))
	else:
		tmp = d * math.pow((h * l), -0.5)
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (h <= -1.35e+127)
		tmp = Float64(d * sqrt(Float64(h * l)));
	else
		tmp = Float64(d * (Float64(h * l) ^ -0.5));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (h <= -1.35e+127)
		tmp = d * sqrt((h * l));
	else
		tmp = d * ((h * l) ^ -0.5);
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -1.35e+127], N[(d * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.35 \cdot 10^{+127}:\\
\;\;\;\;d \cdot \sqrt{h \cdot \ell}\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < -1.3500000000000001e127

    1. Initial program 53.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified53.4%

      \[\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 d around inf 3.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. add-exp-log3.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{e^{\log \left(\frac{1}{h \cdot \ell}\right)}}} \]
      2. log-rec3.4%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{-\log \left(h \cdot \ell\right)}}} \]
    5. Applied egg-rr3.4%

      \[\leadsto d \cdot \sqrt{\color{blue}{e^{-\log \left(h \cdot \ell\right)}}} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt0.5%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{\sqrt{-\log \left(h \cdot \ell\right)} \cdot \sqrt{-\log \left(h \cdot \ell\right)}}}} \]
      2. sqrt-unprod16.5%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{\sqrt{\left(-\log \left(h \cdot \ell\right)\right) \cdot \left(-\log \left(h \cdot \ell\right)\right)}}}} \]
      3. sqr-neg16.5%

        \[\leadsto d \cdot \sqrt{e^{\sqrt{\color{blue}{\log \left(h \cdot \ell\right) \cdot \log \left(h \cdot \ell\right)}}}} \]
      4. sqrt-unprod16.0%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{\sqrt{\log \left(h \cdot \ell\right)} \cdot \sqrt{\log \left(h \cdot \ell\right)}}}} \]
      5. add-sqr-sqrt16.5%

        \[\leadsto d \cdot \sqrt{e^{\color{blue}{\log \left(h \cdot \ell\right)}}} \]
      6. *-commutative16.5%

        \[\leadsto d \cdot \sqrt{e^{\log \color{blue}{\left(\ell \cdot h\right)}}} \]
      7. add-exp-log16.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\ell \cdot h}} \]
    7. Applied egg-rr16.5%

      \[\leadsto d \cdot \sqrt{\color{blue}{\ell \cdot h}} \]

    if -1.3500000000000001e127 < h

    1. Initial program 63.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified63.4%

      \[\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. Step-by-step derivation
      1. fma-udef63.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left({\left(\frac{-0.5 \cdot M}{d} \cdot D\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right)} \]
      2. *-commutative63.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\color{blue}{\left(D \cdot \frac{-0.5 \cdot M}{d}\right)}}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right) \]
      3. *-un-lft-identity63.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\left(D \cdot \frac{-0.5 \cdot M}{\color{blue}{1 \cdot d}}\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right) \]
      4. times-frac63.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\left(D \cdot \color{blue}{\left(\frac{-0.5}{1} \cdot \frac{M}{d}\right)}\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right) \]
      5. metadata-eval63.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\left(D \cdot \left(\color{blue}{-0.5} \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right) + 1\right) \]
      6. *-commutative63.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \color{blue}{\left(\frac{h}{\ell} \cdot -0.5\right)} + 1\right) \]
    4. Applied egg-rr63.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left({\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + 1\right)} \]
    5. Taylor expanded in d around inf 32.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. unpow1/232.2%

        \[\leadsto d \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \]
      2. rem-exp-log31.1%

        \[\leadsto d \cdot {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \]
      3. exp-neg31.1%

        \[\leadsto d \cdot {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \]
      4. exp-prod31.1%

        \[\leadsto d \cdot \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \]
      5. distribute-lft-neg-out31.1%

        \[\leadsto d \cdot e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \]
      6. distribute-rgt-neg-in31.1%

        \[\leadsto d \cdot e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \]
      7. metadata-eval31.1%

        \[\leadsto d \cdot e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \]
      8. exp-to-pow32.2%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    7. Simplified32.2%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -1.35 \cdot 10^{+127}:\\ \;\;\;\;d \cdot \sqrt{h \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \]

Alternative 19: 4.1% accurate, 3.2× speedup?

\[\begin{array}{l} \\ d \cdot \sqrt{h \cdot \ell} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (sqrt (* h l))))
double code(double d, double h, double l, double M, double D) {
	return d * sqrt((h * l));
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d * sqrt((h * l))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.sqrt((h * l));
}
def code(d, h, l, M, D):
	return d * math.sqrt((h * l))
function code(d, h, l, M, D)
	return Float64(d * sqrt(Float64(h * l)))
end
function tmp = code(d, h, l, M, D)
	tmp = d * sqrt((h * l));
end
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot \sqrt{h \cdot \ell}
\end{array}
Derivation
  1. Initial program 62.0%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified62.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 d around inf 28.2%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  4. Step-by-step derivation
    1. add-exp-log27.2%

      \[\leadsto d \cdot \sqrt{\color{blue}{e^{\log \left(\frac{1}{h \cdot \ell}\right)}}} \]
    2. log-rec27.2%

      \[\leadsto d \cdot \sqrt{e^{\color{blue}{-\log \left(h \cdot \ell\right)}}} \]
  5. Applied egg-rr27.2%

    \[\leadsto d \cdot \sqrt{\color{blue}{e^{-\log \left(h \cdot \ell\right)}}} \]
  6. Step-by-step derivation
    1. add-sqr-sqrt14.7%

      \[\leadsto d \cdot \sqrt{e^{\color{blue}{\sqrt{-\log \left(h \cdot \ell\right)} \cdot \sqrt{-\log \left(h \cdot \ell\right)}}}} \]
    2. sqrt-unprod18.4%

      \[\leadsto d \cdot \sqrt{e^{\color{blue}{\sqrt{\left(-\log \left(h \cdot \ell\right)\right) \cdot \left(-\log \left(h \cdot \ell\right)\right)}}}} \]
    3. sqr-neg18.4%

      \[\leadsto d \cdot \sqrt{e^{\sqrt{\color{blue}{\log \left(h \cdot \ell\right) \cdot \log \left(h \cdot \ell\right)}}}} \]
    4. sqrt-unprod3.5%

      \[\leadsto d \cdot \sqrt{e^{\color{blue}{\sqrt{\log \left(h \cdot \ell\right)} \cdot \sqrt{\log \left(h \cdot \ell\right)}}}} \]
    5. add-sqr-sqrt4.8%

      \[\leadsto d \cdot \sqrt{e^{\color{blue}{\log \left(h \cdot \ell\right)}}} \]
    6. *-commutative4.8%

      \[\leadsto d \cdot \sqrt{e^{\log \color{blue}{\left(\ell \cdot h\right)}}} \]
    7. add-exp-log4.8%

      \[\leadsto d \cdot \sqrt{\color{blue}{\ell \cdot h}} \]
  7. Applied egg-rr4.8%

    \[\leadsto d \cdot \sqrt{\color{blue}{\ell \cdot h}} \]
  8. Final simplification4.8%

    \[\leadsto d \cdot \sqrt{h \cdot \ell} \]

Reproduce

?
herbie shell --seed 2023333 
(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)))))