Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.3% → 80.0%
Time: 29.4s
Alternatives: 24
Speedup: 1.5×

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 24 alternatives:

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

Initial Program: 66.3% accurate, 1.0× speedup?

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

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

Alternative 1: 80.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := 1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\\ t_2 := \frac{\sqrt{d}}{\sqrt{h}}\\ \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left({\left({\left(\frac{-1}{d}\right)}^{-0.25} \cdot {\left(\frac{-1}{h}\right)}^{0.25}\right)}^{2} \cdot t_0\right) \cdot t_1\\ \mathbf{elif}\;h \leq 2.05 \cdot 10^{+210}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(t_2 \cdot \mathsf{fma}\left({\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot t_2\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l)))
        (t_1 (- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l))))
        (t_2 (/ (sqrt d) (sqrt h))))
   (if (<= h -2e-310)
     (* (* (pow (* (pow (/ -1.0 d) -0.25) (pow (/ -1.0 h) 0.25)) 2.0) t_0) t_1)
     (if (<= h 2.05e+210)
       (*
        (/ (sqrt d) (sqrt l))
        (* t_2 (fma (pow (* 0.5 (/ M (/ d D))) 2.0) (* -0.5 (/ h l)) 1.0)))
       (* t_1 (* t_0 t_2))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = 1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l));
	double t_2 = sqrt(d) / sqrt(h);
	double tmp;
	if (h <= -2e-310) {
		tmp = (pow((pow((-1.0 / d), -0.25) * pow((-1.0 / h), 0.25)), 2.0) * t_0) * t_1;
	} else if (h <= 2.05e+210) {
		tmp = (sqrt(d) / sqrt(l)) * (t_2 * fma(pow((0.5 * (M / (d / D))), 2.0), (-0.5 * (h / l)), 1.0));
	} else {
		tmp = t_1 * (t_0 * t_2);
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l)))
	t_2 = Float64(sqrt(d) / sqrt(h))
	tmp = 0.0
	if (h <= -2e-310)
		tmp = Float64(Float64((Float64((Float64(-1.0 / d) ^ -0.25) * (Float64(-1.0 / h) ^ 0.25)) ^ 2.0) * t_0) * t_1);
	elseif (h <= 2.05e+210)
		tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(t_2 * fma((Float64(0.5 * Float64(M / Float64(d / D))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0)));
	else
		tmp = Float64(t_1 * Float64(t_0 * t_2));
	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[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(N[Power[N[(N[Power[N[(-1.0 / d), $MachinePrecision], -0.25], $MachinePrecision] * N[Power[N[(-1.0 / h), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[h, 2.05e+210], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[(N[Power[N[(0.5 * N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot t_2\right)\\


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

    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. Simplified72.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(e^{\log \left(\frac{-1}{d}\right) \cdot \color{blue}{\left(0.25 \cdot -1\right)}} \cdot e^{\log \left(\frac{-1}{h}\right) \cdot 0.25}\right)}^{2} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
      10. exp-to-pow81.9%

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

        \[\leadsto \left({\left({\left(\frac{-1}{d}\right)}^{\color{blue}{-0.25}} \cdot e^{\log \left(\frac{-1}{h}\right) \cdot 0.25}\right)}^{2} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
      12. exp-to-pow84.7%

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

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

    if -1.999999999999994e-310 < h < 2.05e210

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

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

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

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

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

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

    if 2.05e210 < h

    1. Initial program 41.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. Simplified41.7%

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

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

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

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

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

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

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

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

Alternative 2: 78.8% accurate, 0.6× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(e^{\log \left(\frac{-1}{d}\right) \cdot \color{blue}{\left(0.25 \cdot -1\right)}} \cdot e^{\log \left(\frac{-1}{h}\right) \cdot 0.25}\right)}^{2} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
      10. exp-to-pow82.6%

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

        \[\leadsto \left({\left({\left(\frac{-1}{d}\right)}^{\color{blue}{-0.25}} \cdot e^{\log \left(\frac{-1}{h}\right) \cdot 0.25}\right)}^{2} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
      12. exp-to-pow85.4%

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

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

    if -2.6e-306 < d < 1.1499999999999999e-174

    1. Initial program 32.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. Simplified31.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1499999999999999e-174 < d

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

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

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

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

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

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

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

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

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

Alternative 3: 74.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \frac{\sqrt{d}}{\sqrt{h}}\\ \mathbf{if}\;h \leq -1.4 \cdot 10^{+253}:\\ \;\;\;\;\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;h \leq -5.3 \cdot 10^{+109}:\\ \;\;\;\;\left(t_1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t_0}{\ell}\right)\right)\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right)\\ \mathbf{elif}\;h \leq 2.55 \cdot 10^{+208}:\\ \;\;\;\;t_1 \cdot \left(t_2 \cdot \mathsf{fma}\left({\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(t_1 \cdot t_2\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (* M (* 0.5 (/ D d))) 2.0))
        (t_1 (sqrt (/ d l)))
        (t_2 (/ (sqrt d) (sqrt h))))
   (if (<= h -1.4e+253)
     (-
      (* (/ (pow (* M D) 2.0) d) (* (sqrt (/ h (pow l 3.0))) 0.125))
      (* d (sqrt (/ 1.0 (* h l)))))
     (if (<= h -5.3e+109)
       (* (* t_1 (sqrt (/ d h))) (- 1.0 (* 0.5 (* h (/ t_0 l)))))
       (if (<= h -2e-310)
         (* (* d (sqrt (/ (/ 1.0 l) h))) (- -1.0 (* -0.5 (* (/ h l) t_0))))
         (if (<= h 2.55e+208)
           (*
            t_1
            (* t_2 (fma (pow (* 0.5 (/ M (/ d D))) 2.0) (* -0.5 (/ h l)) 1.0)))
           (*
            (- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l)))
            (* t_1 t_2))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow((M * (0.5 * (D / d))), 2.0);
	double t_1 = sqrt((d / l));
	double t_2 = sqrt(d) / sqrt(h);
	double tmp;
	if (h <= -1.4e+253) {
		tmp = ((pow((M * D), 2.0) / d) * (sqrt((h / pow(l, 3.0))) * 0.125)) - (d * sqrt((1.0 / (h * l))));
	} else if (h <= -5.3e+109) {
		tmp = (t_1 * sqrt((d / h))) * (1.0 - (0.5 * (h * (t_0 / l))));
	} else if (h <= -2e-310) {
		tmp = (d * sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	} else if (h <= 2.55e+208) {
		tmp = t_1 * (t_2 * fma(pow((0.5 * (M / (d / D))), 2.0), (-0.5 * (h / l)), 1.0));
	} else {
		tmp = (1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (t_1 * t_2);
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0
	t_1 = sqrt(Float64(d / l))
	t_2 = Float64(sqrt(d) / sqrt(h))
	tmp = 0.0
	if (h <= -1.4e+253)
		tmp = Float64(Float64(Float64((Float64(M * D) ^ 2.0) / d) * Float64(sqrt(Float64(h / (l ^ 3.0))) * 0.125)) - Float64(d * sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (h <= -5.3e+109)
		tmp = Float64(Float64(t_1 * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))));
	elseif (h <= -2e-310)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_0))));
	elseif (h <= 2.55e+208)
		tmp = Float64(t_1 * Float64(t_2 * fma((Float64(0.5 * Float64(M / Float64(d / D))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0)));
	else
		tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))) * Float64(t_1 * t_2));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.4e+253], N[(N[(N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] - N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5.3e+109], N[(N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.55e+208], N[(t$95$1 * N[(t$95$2 * N[(N[Power[N[(0.5 * N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;h \leq 2.55 \cdot 10^{+208}:\\
\;\;\;\;t_1 \cdot \left(t_2 \cdot \mathsf{fma}\left({\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if h < -1.4e253

    1. Initial program 30.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. Simplified30.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm130.0%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 70.0%

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

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

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

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

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

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

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

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

    if -1.4e253 < h < -5.30000000000000026e109

    1. Initial program 79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.30000000000000026e109 < h < -1.999999999999994e-310

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm157.6%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 85.2%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*85.2%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg85.2%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*85.2%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified85.2%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]

    if -1.999999999999994e-310 < h < 2.5500000000000001e208

    1. Initial program 73.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. Simplified72.5%

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

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

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

    if 2.5500000000000001e208 < h

    1. Initial program 40.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. Simplified40.1%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -1.4 \cdot 10^{+253}:\\ \;\;\;\;\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;h \leq -5.3 \cdot 10^{+109}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{elif}\;h \leq 2.55 \cdot 10^{+208}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\ \end{array} \]

Alternative 4: 73.1% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;\ell \leq -4.5 \cdot 10^{-88}:\\
\;\;\;\;\frac{t_2}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - t_3\\

\mathbf{elif}\;\ell \leq -1.4 \cdot 10^{-235}:\\
\;\;\;\;t_3 \cdot t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if l < -1.85000000000000011e102

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm155.8%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 73.8%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*73.8%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg73.8%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*73.8%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified73.8%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]

    if -1.85000000000000011e102 < l < -4.49999999999999991e-88

    1. Initial program 68.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm146.1%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 79.4%

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

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

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

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

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

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

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

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

    if -4.49999999999999991e-88 < l < -1.39999999999999998e-235

    1. Initial program 77.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. Simplified77.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm161.7%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 83.6%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. mul-1-neg83.6%

        \[\leadsto \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. distribute-rgt-neg-in83.6%

        \[\leadsto \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
      3. *-commutative83.6%

        \[\leadsto \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \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) \]
    9. Simplified83.6%

      \[\leadsto \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \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) \]

    if -1.39999999999999998e-235 < l < 2.1499999999999999e-107

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

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

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

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

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

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

    if 2.1499999999999999e-107 < l < 3.0999999999999999e171

    1. Initial program 65.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. Simplified64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\sqrt{h}}{{\ell}^{1.5}}}, \frac{-0.125}{\frac{d}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}}, d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
    10. Step-by-step derivation
      1. fma-udef84.8%

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

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

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

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

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

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

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

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

    if 3.0999999999999999e171 < l

    1. Initial program 66.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.85 \cdot 10^{+102}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{elif}\;\ell \leq -4.5 \cdot 10^{-88}:\\ \;\;\;\;\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;\ell \leq -1.4 \cdot 10^{-235}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \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)\\ \mathbf{elif}\;\ell \leq 2.15 \cdot 10^{-107}:\\ \;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\ \mathbf{elif}\;\ell \leq 3.1 \cdot 10^{+171}:\\ \;\;\;\;\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \left(\frac{-0.125}{d} \cdot {\left(M \cdot D\right)}^{2}\right) + \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\ \end{array} \]

Alternative 5: 74.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := {\left(M \cdot D\right)}^{2}\\ t_2 := 1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\\ t_3 := \frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_0\\ \mathbf{if}\;\ell \leq -1.1 \cdot 10^{+101}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{elif}\;\ell \leq -3.4 \cdot 10^{-104}:\\ \;\;\;\;\frac{t_1}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;t_2 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_0\right)\\ \mathbf{elif}\;\ell \leq 2.1 \cdot 10^{-107}:\\ \;\;\;\;t_2 \cdot t_3\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{+167}:\\ \;\;\;\;\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \left(\frac{-0.125}{d} \cdot t_1\right) + \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot t_3\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d h)))
        (t_1 (pow (* M D) 2.0))
        (t_2 (- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l))))
        (t_3 (* (/ (sqrt d) (sqrt l)) t_0)))
   (if (<= l -1.1e+101)
     (*
      (* d (sqrt (/ (/ 1.0 l) h)))
      (- -1.0 (* -0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))
     (if (<= l -3.4e-104)
       (-
        (* (/ t_1 d) (* (sqrt (/ h (pow l 3.0))) 0.125))
        (* d (sqrt (/ 1.0 (* h l)))))
       (if (<= l -2e-310)
         (* t_2 (* (sqrt (/ d l)) t_0))
         (if (<= l 2.1e-107)
           (* t_2 t_3)
           (if (<= l 2e+167)
             (+
              (* (/ (sqrt h) (pow l 1.5)) (* (/ -0.125 d) t_1))
              (/ d (sqrt (* h l))))
             (*
              (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))
              t_3))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h));
	double t_1 = pow((M * D), 2.0);
	double t_2 = 1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l));
	double t_3 = (sqrt(d) / sqrt(l)) * t_0;
	double tmp;
	if (l <= -1.1e+101) {
		tmp = (d * sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
	} else if (l <= -3.4e-104) {
		tmp = ((t_1 / d) * (sqrt((h / pow(l, 3.0))) * 0.125)) - (d * sqrt((1.0 / (h * l))));
	} else if (l <= -2e-310) {
		tmp = t_2 * (sqrt((d / l)) * t_0);
	} else if (l <= 2.1e-107) {
		tmp = t_2 * t_3;
	} else if (l <= 2e+167) {
		tmp = ((sqrt(h) / pow(l, 1.5)) * ((-0.125 / d) * t_1)) + (d / sqrt((h * l)));
	} else {
		tmp = (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))) * t_3;
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = sqrt((d / h))
    t_1 = (m * d_1) ** 2.0d0
    t_2 = 1.0d0 - (0.5d0 * ((h * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l))
    t_3 = (sqrt(d) / sqrt(l)) * t_0
    if (l <= (-1.1d+101)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
    else if (l <= (-3.4d-104)) then
        tmp = ((t_1 / d) * (sqrt((h / (l ** 3.0d0))) * 0.125d0)) - (d * sqrt((1.0d0 / (h * l))))
    else if (l <= (-2d-310)) then
        tmp = t_2 * (sqrt((d / l)) * t_0)
    else if (l <= 2.1d-107) then
        tmp = t_2 * t_3
    else if (l <= 2d+167) then
        tmp = ((sqrt(h) / (l ** 1.5d0)) * (((-0.125d0) / d) * t_1)) + (d / sqrt((h * l)))
    else
        tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))) * t_3
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h));
	double t_1 = Math.pow((M * D), 2.0);
	double t_2 = 1.0 - (0.5 * ((h * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l));
	double t_3 = (Math.sqrt(d) / Math.sqrt(l)) * t_0;
	double tmp;
	if (l <= -1.1e+101) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
	} else if (l <= -3.4e-104) {
		tmp = ((t_1 / d) * (Math.sqrt((h / Math.pow(l, 3.0))) * 0.125)) - (d * Math.sqrt((1.0 / (h * l))));
	} else if (l <= -2e-310) {
		tmp = t_2 * (Math.sqrt((d / l)) * t_0);
	} else if (l <= 2.1e-107) {
		tmp = t_2 * t_3;
	} else if (l <= 2e+167) {
		tmp = ((Math.sqrt(h) / Math.pow(l, 1.5)) * ((-0.125 / d) * t_1)) + (d / Math.sqrt((h * l)));
	} else {
		tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))) * t_3;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = math.pow((M * D), 2.0)
	t_2 = 1.0 - (0.5 * ((h * math.pow(((0.5 * M) * (D / d)), 2.0)) / l))
	t_3 = (math.sqrt(d) / math.sqrt(l)) * t_0
	tmp = 0
	if l <= -1.1e+101:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0))))
	elif l <= -3.4e-104:
		tmp = ((t_1 / d) * (math.sqrt((h / math.pow(l, 3.0))) * 0.125)) - (d * math.sqrt((1.0 / (h * l))))
	elif l <= -2e-310:
		tmp = t_2 * (math.sqrt((d / l)) * t_0)
	elif l <= 2.1e-107:
		tmp = t_2 * t_3
	elif l <= 2e+167:
		tmp = ((math.sqrt(h) / math.pow(l, 1.5)) * ((-0.125 / d) * t_1)) + (d / math.sqrt((h * l)))
	else:
		tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0)))) * t_3
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = Float64(M * D) ^ 2.0
	t_2 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l)))
	t_3 = Float64(Float64(sqrt(d) / sqrt(l)) * t_0)
	tmp = 0.0
	if (l <= -1.1e+101)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0)))));
	elseif (l <= -3.4e-104)
		tmp = Float64(Float64(Float64(t_1 / d) * Float64(sqrt(Float64(h / (l ^ 3.0))) * 0.125)) - Float64(d * sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (l <= -2e-310)
		tmp = Float64(t_2 * Float64(sqrt(Float64(d / l)) * t_0));
	elseif (l <= 2.1e-107)
		tmp = Float64(t_2 * t_3);
	elseif (l <= 2e+167)
		tmp = Float64(Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64(Float64(-0.125 / d) * t_1)) + Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))) * t_3);
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = (M * D) ^ 2.0;
	t_2 = 1.0 - (0.5 * ((h * (((0.5 * M) * (D / d)) ^ 2.0)) / l));
	t_3 = (sqrt(d) / sqrt(l)) * t_0;
	tmp = 0.0;
	if (l <= -1.1e+101)
		tmp = (d * sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
	elseif (l <= -3.4e-104)
		tmp = ((t_1 / d) * (sqrt((h / (l ^ 3.0))) * 0.125)) - (d * sqrt((1.0 / (h * l))));
	elseif (l <= -2e-310)
		tmp = t_2 * (sqrt((d / l)) * t_0);
	elseif (l <= 2.1e-107)
		tmp = t_2 * t_3;
	elseif (l <= 2e+167)
		tmp = ((sqrt(h) / (l ^ 1.5)) * ((-0.125 / d) * t_1)) + (d / sqrt((h * l)));
	else
		tmp = (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))) * t_3;
	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[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[l, -1.1e+101], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $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], If[LessEqual[l, -3.4e-104], N[(N[(N[(t$95$1 / d), $MachinePrecision] * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] - N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(t$95$2 * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.1e-107], N[(t$95$2 * t$95$3), $MachinePrecision], If[LessEqual[l, 2e+167], N[(N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 / d), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_2 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_0\right)\\

\mathbf{elif}\;\ell \leq 2.1 \cdot 10^{-107}:\\
\;\;\;\;t_2 \cdot t_3\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if l < -1.1e101

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm155.8%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 73.8%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*73.8%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg73.8%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*73.8%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified73.8%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]

    if -1.1e101 < l < -3.40000000000000015e-104

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm147.9%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 76.9%

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

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

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

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

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

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

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

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

    if -3.40000000000000015e-104 < l < -1.999999999999994e-310

    1. Initial program 77.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. Simplified77.5%

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

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

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

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

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

    if -1.999999999999994e-310 < l < 2.0999999999999999e-107

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

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

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

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

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

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

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

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

    if 2.0999999999999999e-107 < l < 2.0000000000000001e167

    1. Initial program 65.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. Simplified64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\sqrt{h}}{{\ell}^{1.5}}}, \frac{-0.125}{\frac{d}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}}, d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
    10. Step-by-step derivation
      1. fma-udef84.8%

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

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

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

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

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

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

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

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

    if 2.0000000000000001e167 < l

    1. Initial program 66.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.1 \cdot 10^{+101}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{elif}\;\ell \leq -3.4 \cdot 10^{-104}:\\ \;\;\;\;\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\ \mathbf{elif}\;\ell \leq 2.1 \cdot 10^{-107}:\\ \;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{+167}:\\ \;\;\;\;\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \left(\frac{-0.125}{d} \cdot {\left(M \cdot D\right)}^{2}\right) + \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\ \end{array} \]

Alternative 6: 74.1% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if h < -1.55000000000000003e253

    1. Initial program 30.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. Simplified30.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm130.0%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 70.0%

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

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

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

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

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

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

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

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

    if -1.55000000000000003e253 < h < -2.9e109

    1. Initial program 79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.9e109 < h < -1.999999999999994e-310

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm157.6%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 85.2%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*85.2%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg85.2%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*85.2%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified85.2%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]

    if -1.999999999999994e-310 < h

    1. Initial program 67.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. Simplified66.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -1.55 \cdot 10^{+253}:\\ \;\;\;\;\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;h \leq -2.9 \cdot 10^{+109}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\ \end{array} \]

Alternative 7: 75.2% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if h < -1.80000000000000001e248

    1. Initial program 30.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. Simplified30.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm130.0%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 70.0%

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

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

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

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

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

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

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

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

    if -1.80000000000000001e248 < h < -8.7999999999999997e109

    1. Initial program 79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.7999999999999997e109 < h < -1.999999999999994e-310

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm157.6%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 85.2%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*85.2%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg85.2%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*85.2%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified85.2%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]

    if -1.999999999999994e-310 < h

    1. Initial program 67.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. Simplified66.3%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -1.8 \cdot 10^{+248}:\\ \;\;\;\;\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;h \leq -8.8 \cdot 10^{+109}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\ \end{array} \]

Alternative 8: 73.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\\ t_1 := \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t_0}{\ell}\right)\right)\\ t_2 := \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right)\\ \mathbf{if}\;d \leq -1.5 \cdot 10^{+82}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq -2.3 \cdot 10^{-93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 3.45 \cdot 10^{-305}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq 4.5 \cdot 10^{-174}:\\ \;\;\;\;\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \left(\frac{-0.125}{d} \cdot {\left(M \cdot D\right)}^{2}\right) + \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (* M (* 0.5 (/ D d))) 2.0))
        (t_1
         (* (* (sqrt (/ d l)) (sqrt (/ d h))) (- 1.0 (* 0.5 (* h (/ t_0 l))))))
        (t_2
         (* (* d (sqrt (/ (/ 1.0 l) h))) (- -1.0 (* -0.5 (* (/ h l) t_0))))))
   (if (<= d -1.5e+82)
     t_2
     (if (<= d -2.3e-93)
       t_1
       (if (<= d 3.45e-305)
         t_2
         (if (<= d 4.5e-174)
           (+
            (* (/ (sqrt h) (pow l 1.5)) (* (/ -0.125 d) (pow (* M D) 2.0)))
            (/ d (sqrt (* h l))))
           t_1))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow((M * (0.5 * (D / d))), 2.0);
	double t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * (h * (t_0 / l))));
	double t_2 = (d * sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	double tmp;
	if (d <= -1.5e+82) {
		tmp = t_2;
	} else if (d <= -2.3e-93) {
		tmp = t_1;
	} else if (d <= 3.45e-305) {
		tmp = t_2;
	} else if (d <= 4.5e-174) {
		tmp = ((sqrt(h) / pow(l, 1.5)) * ((-0.125 / d) * pow((M * D), 2.0))) + (d / sqrt((h * l)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (m * (0.5d0 * (d_1 / d))) ** 2.0d0
    t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * (h * (t_0 / l))))
    t_2 = (d * sqrt(((1.0d0 / l) / h))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * t_0)))
    if (d <= (-1.5d+82)) then
        tmp = t_2
    else if (d <= (-2.3d-93)) then
        tmp = t_1
    else if (d <= 3.45d-305) then
        tmp = t_2
    else if (d <= 4.5d-174) then
        tmp = ((sqrt(h) / (l ** 1.5d0)) * (((-0.125d0) / d) * ((m * d_1) ** 2.0d0))) + (d / sqrt((h * l)))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow((M * (0.5 * (D / d))), 2.0);
	double t_1 = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * (h * (t_0 / l))));
	double t_2 = (d * Math.sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	double tmp;
	if (d <= -1.5e+82) {
		tmp = t_2;
	} else if (d <= -2.3e-93) {
		tmp = t_1;
	} else if (d <= 3.45e-305) {
		tmp = t_2;
	} else if (d <= 4.5e-174) {
		tmp = ((Math.sqrt(h) / Math.pow(l, 1.5)) * ((-0.125 / d) * Math.pow((M * D), 2.0))) + (d / Math.sqrt((h * l)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.pow((M * (0.5 * (D / d))), 2.0)
	t_1 = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * (h * (t_0 / l))))
	t_2 = (d * math.sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * t_0)))
	tmp = 0
	if d <= -1.5e+82:
		tmp = t_2
	elif d <= -2.3e-93:
		tmp = t_1
	elif d <= 3.45e-305:
		tmp = t_2
	elif d <= 4.5e-174:
		tmp = ((math.sqrt(h) / math.pow(l, 1.5)) * ((-0.125 / d) * math.pow((M * D), 2.0))) + (d / math.sqrt((h * l)))
	else:
		tmp = t_1
	return tmp
function code(d, h, l, M, D)
	t_0 = Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0
	t_1 = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))))
	t_2 = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_0))))
	tmp = 0.0
	if (d <= -1.5e+82)
		tmp = t_2;
	elseif (d <= -2.3e-93)
		tmp = t_1;
	elseif (d <= 3.45e-305)
		tmp = t_2;
	elseif (d <= 4.5e-174)
		tmp = Float64(Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64(Float64(-0.125 / d) * (Float64(M * D) ^ 2.0))) + Float64(d / sqrt(Float64(h * l))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = (M * (0.5 * (D / d))) ^ 2.0;
	t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * (h * (t_0 / l))));
	t_2 = (d * sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	tmp = 0.0;
	if (d <= -1.5e+82)
		tmp = t_2;
	elseif (d <= -2.3e-93)
		tmp = t_1;
	elseif (d <= 3.45e-305)
		tmp = t_2;
	elseif (d <= 4.5e-174)
		tmp = ((sqrt(h) / (l ^ 1.5)) * ((-0.125 / d) * ((M * D) ^ 2.0))) + (d / sqrt((h * l)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.5e+82], t$95$2, If[LessEqual[d, -2.3e-93], t$95$1, If[LessEqual[d, 3.45e-305], t$95$2, If[LessEqual[d, 4.5e-174], N[(N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 / d), $MachinePrecision] * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -2.3 \cdot 10^{-93}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq 3.45 \cdot 10^{-305}:\\
\;\;\;\;t_2\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.49999999999999995e82 or -2.2999999999999998e-93 < d < 3.4499999999999999e-305

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm154.4%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 78.5%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*78.5%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg78.5%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*78.5%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified78.5%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]

    if -1.49999999999999995e82 < d < -2.2999999999999998e-93 or 4.49999999999999964e-174 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.4499999999999999e-305 < d < 4.49999999999999964e-174

    1. Initial program 28.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. Simplified28.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\sqrt{h}}{{\ell}^{1.5}}}, \frac{-0.125}{\frac{d}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}}, d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
    10. Step-by-step derivation
      1. fma-udef73.1%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.5 \cdot 10^{+82}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{elif}\;d \leq -2.3 \cdot 10^{-93}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq 3.45 \cdot 10^{-305}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{elif}\;d \leq 4.5 \cdot 10^{-174}:\\ \;\;\;\;\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \left(\frac{-0.125}{d} \cdot {\left(M \cdot D\right)}^{2}\right) + \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \end{array} \]

Alternative 9: 72.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\\ t_1 := \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t_0}{\ell}\right)\right)\\ t_2 := {\left(M \cdot D\right)}^{2}\\ \mathbf{if}\;d \leq -2.4 \cdot 10^{+86}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right)\\ \mathbf{elif}\;d \leq -1.7 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{t_2}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 2.9 \cdot 10^{-173}:\\ \;\;\;\;\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \left(\frac{-0.125}{d} \cdot t_2\right) + \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (* M (* 0.5 (/ D d))) 2.0))
        (t_1
         (* (* (sqrt (/ d l)) (sqrt (/ d h))) (- 1.0 (* 0.5 (* h (/ t_0 l))))))
        (t_2 (pow (* M D) 2.0)))
   (if (<= d -2.4e+86)
     (* (* d (sqrt (/ (/ 1.0 l) h))) (- -1.0 (* -0.5 (* (/ h l) t_0))))
     (if (<= d -1.7e-101)
       t_1
       (if (<= d -5e-310)
         (-
          (* (/ t_2 d) (* (sqrt (/ h (pow l 3.0))) 0.125))
          (* d (sqrt (/ 1.0 (* h l)))))
         (if (<= d 2.9e-173)
           (+
            (* (/ (sqrt h) (pow l 1.5)) (* (/ -0.125 d) t_2))
            (/ d (sqrt (* h l))))
           t_1))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow((M * (0.5 * (D / d))), 2.0);
	double t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * (h * (t_0 / l))));
	double t_2 = pow((M * D), 2.0);
	double tmp;
	if (d <= -2.4e+86) {
		tmp = (d * sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	} else if (d <= -1.7e-101) {
		tmp = t_1;
	} else if (d <= -5e-310) {
		tmp = ((t_2 / d) * (sqrt((h / pow(l, 3.0))) * 0.125)) - (d * sqrt((1.0 / (h * l))));
	} else if (d <= 2.9e-173) {
		tmp = ((sqrt(h) / pow(l, 1.5)) * ((-0.125 / d) * t_2)) + (d / sqrt((h * l)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (m * (0.5d0 * (d_1 / d))) ** 2.0d0
    t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * (h * (t_0 / l))))
    t_2 = (m * d_1) ** 2.0d0
    if (d <= (-2.4d+86)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * t_0)))
    else if (d <= (-1.7d-101)) then
        tmp = t_1
    else if (d <= (-5d-310)) then
        tmp = ((t_2 / d) * (sqrt((h / (l ** 3.0d0))) * 0.125d0)) - (d * sqrt((1.0d0 / (h * l))))
    else if (d <= 2.9d-173) then
        tmp = ((sqrt(h) / (l ** 1.5d0)) * (((-0.125d0) / d) * t_2)) + (d / sqrt((h * l)))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow((M * (0.5 * (D / d))), 2.0);
	double t_1 = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * (h * (t_0 / l))));
	double t_2 = Math.pow((M * D), 2.0);
	double tmp;
	if (d <= -2.4e+86) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	} else if (d <= -1.7e-101) {
		tmp = t_1;
	} else if (d <= -5e-310) {
		tmp = ((t_2 / d) * (Math.sqrt((h / Math.pow(l, 3.0))) * 0.125)) - (d * Math.sqrt((1.0 / (h * l))));
	} else if (d <= 2.9e-173) {
		tmp = ((Math.sqrt(h) / Math.pow(l, 1.5)) * ((-0.125 / d) * t_2)) + (d / Math.sqrt((h * l)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.pow((M * (0.5 * (D / d))), 2.0)
	t_1 = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * (h * (t_0 / l))))
	t_2 = math.pow((M * D), 2.0)
	tmp = 0
	if d <= -2.4e+86:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * t_0)))
	elif d <= -1.7e-101:
		tmp = t_1
	elif d <= -5e-310:
		tmp = ((t_2 / d) * (math.sqrt((h / math.pow(l, 3.0))) * 0.125)) - (d * math.sqrt((1.0 / (h * l))))
	elif d <= 2.9e-173:
		tmp = ((math.sqrt(h) / math.pow(l, 1.5)) * ((-0.125 / d) * t_2)) + (d / math.sqrt((h * l)))
	else:
		tmp = t_1
	return tmp
function code(d, h, l, M, D)
	t_0 = Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0
	t_1 = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))))
	t_2 = Float64(M * D) ^ 2.0
	tmp = 0.0
	if (d <= -2.4e+86)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_0))));
	elseif (d <= -1.7e-101)
		tmp = t_1;
	elseif (d <= -5e-310)
		tmp = Float64(Float64(Float64(t_2 / d) * Float64(sqrt(Float64(h / (l ^ 3.0))) * 0.125)) - Float64(d * sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (d <= 2.9e-173)
		tmp = Float64(Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64(Float64(-0.125 / d) * t_2)) + Float64(d / sqrt(Float64(h * l))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = (M * (0.5 * (D / d))) ^ 2.0;
	t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * (h * (t_0 / l))));
	t_2 = (M * D) ^ 2.0;
	tmp = 0.0;
	if (d <= -2.4e+86)
		tmp = (d * sqrt(((1.0 / l) / h))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	elseif (d <= -1.7e-101)
		tmp = t_1;
	elseif (d <= -5e-310)
		tmp = ((t_2 / d) * (sqrt((h / (l ^ 3.0))) * 0.125)) - (d * sqrt((1.0 / (h * l))));
	elseif (d <= 2.9e-173)
		tmp = ((sqrt(h) / (l ^ 1.5)) * ((-0.125 / d) * t_2)) + (d / sqrt((h * l)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -2.4e+86], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.7e-101], t$95$1, If[LessEqual[d, -5e-310], N[(N[(N[(t$95$2 / d), $MachinePrecision] * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] - N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.9e-173], N[(N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 / d), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -1.7 \cdot 10^{-101}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_2}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -2.4e86

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm165.3%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 88.0%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*88.0%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg88.0%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*88.0%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified88.0%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]

    if -2.4e86 < d < -1.69999999999999995e-101 or 2.8999999999999998e-173 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.69999999999999995e-101 < d < -4.999999999999985e-310

    1. Initial program 57.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. Simplified57.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm137.4%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 65.2%

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d < 2.8999999999999998e-173

    1. Initial program 33.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. Simplified32.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\sqrt{h}}{{\ell}^{1.5}}}, \frac{-0.125}{\frac{d}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}}, d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
    10. Step-by-step derivation
      1. fma-udef68.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.4 \cdot 10^{+86}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{elif}\;d \leq -1.7 \cdot 10^{-101}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 2.9 \cdot 10^{-173}:\\ \;\;\;\;\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \left(\frac{-0.125}{d} \cdot {\left(M \cdot D\right)}^{2}\right) + \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \end{array} \]

Alternative 10: 70.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.95 \cdot 10^{-306}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < 1.95e-306

    1. Initial program 72.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. Simplified72.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm157.0%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 76.5%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*76.5%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg76.5%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*76.5%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified76.5%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]

    if 1.95e-306 < d < 5.0000000000000001e-170

    1. Initial program 29.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. Simplified29.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.125 \cdot \color{blue}{\frac{{D}^{2} \cdot {M}^{2}}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}} \]
      3. *-commutative47.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e-170 < d < 1.2999999999999999e194

    1. Initial program 83.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. Simplified82.5%

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

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

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

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

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

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

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

    if 1.2999999999999999e194 < d

    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 \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Taylor expanded in d around inf 80.5%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.95 \cdot 10^{-306}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{elif}\;d \leq 5 \cdot 10^{-170}:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}\\ \mathbf{elif}\;d \leq 1.3 \cdot 10^{+194}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot \left(0.25 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \]

Alternative 11: 70.5% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < -4.90000000000000002e110 or -4.00000000000000013e-308 < h

    1. Initial program 67.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. Simplified66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.90000000000000002e110 < h < -4.00000000000000013e-308

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm157.6%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 85.2%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*85.2%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg85.2%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*85.2%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified85.2%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -4.9 \cdot 10^{+110} \lor \neg \left(h \leq -4 \cdot 10^{-308}\right):\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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: 66.6% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 71.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm154.7%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 77.8%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. mul-1-neg77.8%

        \[\leadsto \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. distribute-rgt-neg-in77.8%

        \[\leadsto \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
      3. *-commutative77.8%

        \[\leadsto \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \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) \]
    9. Simplified77.8%

      \[\leadsto \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \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) \]

    if -1.2999999999999999e-233 < l < 9.20000000000000067e69

    1. Initial program 71.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.20000000000000067e69 < l

    1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    8. Step-by-step derivation
      1. unpow-prod-down65.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.3 \cdot 10^{-233}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \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)\\ \mathbf{elif}\;\ell \leq 9.2 \cdot 10^{+69}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \end{array} \]

Alternative 13: 66.9% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 71.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm154.7%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in d around -inf 77.8%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \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) \]
    8. Step-by-step derivation
      1. associate-*r*77.8%

        \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \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) \]
      2. mul-1-neg77.8%

        \[\leadsto \left(\color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \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) \]
      3. associate-/r*77.8%

        \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \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) \]
    9. Simplified77.8%

      \[\leadsto \color{blue}{\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \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) \]

    if -3.80000000000000026e-235 < l < 8.40000000000000003e68

    1. Initial program 71.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.40000000000000003e68 < l

    1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    8. Step-by-step derivation
      1. unpow-prod-down65.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.8 \cdot 10^{-235}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \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)\\ \mathbf{elif}\;\ell \leq 8.4 \cdot 10^{+68}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \end{array} \]

Alternative 14: 47.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;D \leq 1.45 \cdot 10^{-8}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{else}:\\
\;\;\;\;\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) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 1.4500000000000001e-8

    1. Initial program 68.3%

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

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

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

    if 1.4500000000000001e-8 < D

    1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm155.4%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq 1.45 \cdot 10^{-8}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\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) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \end{array} \]

Alternative 15: 47.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;D \leq 1.42 \cdot 10^{-8}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 1.41999999999999998e-8

    1. Initial program 68.3%

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

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

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

    if 1.41999999999999998e-8 < D

    1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm155.4%

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Step-by-step derivation
      1. associate-*l/62.6%

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{\color{blue}{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}}{\ell}\right) \]
      4. associate-/l*63.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
      5. associate-*r*63.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{{\color{blue}{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}}^{2}}{\frac{\ell}{h}}\right) \]
    8. Applied egg-rr63.9%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq 1.42 \cdot 10^{-8}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\ \end{array} \]

Alternative 16: 60.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 2.6 \cdot 10^{+70}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= l 2.6e+70)
   (*
    (sqrt (* (/ d l) (/ d h)))
    (+ 1.0 (* -0.5 (* h (/ (pow (* M (* 0.5 (/ D d))) 2.0) l)))))
   (* d (* (pow h -0.5) (pow l -0.5)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= 2.6e+70) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (h * (pow((M * (0.5 * (D / d))), 2.0) / l))));
	} else {
		tmp = d * (pow(h, -0.5) * pow(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 (l <= 2.6d+70) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (h * (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) / l))))
    else
        tmp = d * ((h ** (-0.5d0)) * (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 (l <= 2.6e+70) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (h * (Math.pow((M * (0.5 * (D / d))), 2.0) / l))));
	} else {
		tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if l <= 2.6e+70:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (h * (math.pow((M * (0.5 * (D / d))), 2.0) / l))))
	else:
		tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= 2.6e+70)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) / l)))));
	else
		tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= 2.6e+70)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (h * (((M * (0.5 * (D / d))) ^ 2.0) / l))));
	else
		tmp = d * ((h ^ -0.5) * (l ^ -0.5));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2.6e+70], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.6 \cdot 10^{+70}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 2.6e70

    1. Initial program 71.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. Simplified71.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Step-by-step derivation
      1. associate-*r/73.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
      2. div-inv73.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
      3. metadata-eval73.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot \color{blue}{0.5}\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
    4. Applied egg-rr73.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    5. Step-by-step derivation
      1. pow173.9%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right)\right)}^{1}} \]
      2. sqrt-unprod64.4%

        \[\leadsto {\left(\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right)\right)}^{1} \]
      3. cancel-sign-sub-inv64.4%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(1 + \left(-0.5\right) \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right)}\right)}^{1} \]
      4. metadata-eval64.4%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \color{blue}{-0.5} \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right)\right)}^{1} \]
      5. associate-/l*62.1%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}}{\frac{\ell}{h}}}\right)\right)}^{1} \]
      6. associate-*l*62.1%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{{\color{blue}{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}}^{2}}{\frac{\ell}{h}}\right)\right)}^{1} \]
    6. Applied egg-rr62.1%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}\right)\right)}^{1}} \]
    7. Simplified63.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \left(\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell} \cdot h\right) \cdot -0.5\right)} \]

    if 2.6e70 < l

    1. Initial program 61.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified60.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Taylor expanded in d around inf 58.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    4. Step-by-step derivation
      1. pow1/258.2%

        \[\leadsto \color{blue}{{\left(\frac{1}{\ell \cdot h}\right)}^{0.5}} \cdot d \]
      2. *-commutative58.2%

        \[\leadsto {\left(\frac{1}{\color{blue}{h \cdot \ell}}\right)}^{0.5} \cdot d \]
    5. Applied egg-rr58.2%

      \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
    6. Step-by-step derivation
      1. unpow1/258.2%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-158.2%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow58.2%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}} \cdot d \]
      4. rem-sqrt-square58.2%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval58.2%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow58.0%

        \[\leadsto \left|\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}}\right| \cdot d \]
      7. fabs-sqr58.0%

        \[\leadsto \color{blue}{\left({\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \cdot d \]
      8. sqr-pow58.2%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Simplified58.2%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    8. Step-by-step derivation
      1. unpow-prod-down65.7%

        \[\leadsto \color{blue}{\left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)} \cdot d \]
    9. Applied egg-rr65.7%

      \[\leadsto \color{blue}{\left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)} \cdot d \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 2.6 \cdot 10^{+70}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \end{array} \]

Alternative 17: 41.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 3.7 \cdot 10^{-99}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;M \leq 1.05 \cdot 10^{+199}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{D \cdot D}{\frac{d}{M \cdot M}}\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= M 3.7e-99)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (if (<= M 1.05e+199)
     (*
      (sqrt (* (/ d l) (/ d h)))
      (+ 1.0 (* -0.5 (* 0.25 (* (/ (* D D) l) (/ (* h (* M M)) (* d d)))))))
     (* -0.125 (* (sqrt (/ h (pow l 3.0))) (/ (* D D) (/ d (* M M))))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 3.7e-99) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (M <= 1.05e+199) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	} else {
		tmp = -0.125 * (sqrt((h / pow(l, 3.0))) * ((D * D) / (d / (M * M))));
	}
	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 (m <= 3.7d-99) then
        tmp = sqrt((d / l)) * sqrt((d / h))
    else if (m <= 1.05d+199) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (0.25d0 * (((d_1 * d_1) / l) * ((h * (m * m)) / (d * d))))))
    else
        tmp = (-0.125d0) * (sqrt((h / (l ** 3.0d0))) * ((d_1 * d_1) / (d / (m * m))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 3.7e-99) {
		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
	} else if (M <= 1.05e+199) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	} else {
		tmp = -0.125 * (Math.sqrt((h / Math.pow(l, 3.0))) * ((D * D) / (d / (M * M))));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if M <= 3.7e-99:
		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
	elif M <= 1.05e+199:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))))
	else:
		tmp = -0.125 * (math.sqrt((h / math.pow(l, 3.0))) * ((D * D) / (d / (M * M))))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (M <= 3.7e-99)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (M <= 1.05e+199)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * Float64(Float64(Float64(D * D) / l) * Float64(Float64(h * Float64(M * M)) / Float64(d * d)))))));
	else
		tmp = Float64(-0.125 * Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(Float64(D * D) / Float64(d / Float64(M * M)))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (M <= 3.7e-99)
		tmp = sqrt((d / l)) * sqrt((d / h));
	elseif (M <= 1.05e+199)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	else
		tmp = -0.125 * (sqrt((h / (l ^ 3.0))) * ((D * D) / (d / (M * M))));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[M, 3.7e-99], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.05e+199], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.7 \cdot 10^{-99}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{elif}\;M \leq 1.05 \cdot 10^{+199}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{D \cdot D}{\frac{d}{M \cdot M}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 3.7e-99

    1. Initial program 70.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Taylor expanded in M around 0 47.7%

      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{1}\right) \]

    if 3.7e-99 < M < 1.05e199

    1. Initial program 64.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.7%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u29.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\right)} \]
      2. expm1-udef22.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} - 1} \]
    4. Applied egg-rr19.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def25.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p53.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \]
      3. rem-log-exp49.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\log \left(e^{1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      4. exp-sum49.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \log \color{blue}{\left(e^{1} \cdot e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      5. log-prod49.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(\log \left(e^{1}\right) + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right)} \]
      6. rem-log-exp49.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(\color{blue}{1} + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right) \]
      7. *-commutative49.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm149.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
      9. log1p-def49.6%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
    6. Simplified53.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in h around 0 44.8%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
    8. Step-by-step derivation
      1. associate-*r/44.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2} \cdot \ell}}\right) \]
      2. *-commutative44.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}\right)}{{d}^{2} \cdot \ell}\right) \]
      3. associate-*r/44.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
      4. *-commutative44.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}}\right)\right) \]
      5. times-frac41.0%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)}\right)\right) \]
      6. unpow241.0%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)\right)\right) \]
      7. *-commutative41.0%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{h \cdot {M}^{2}}}{{d}^{2}}\right)\right)\right) \]
      8. unpow241.0%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \color{blue}{\left(M \cdot M\right)}}{{d}^{2}}\right)\right)\right) \]
      9. unpow241.0%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{d \cdot d}}\right)\right)\right) \]
    9. Simplified41.0%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)}\right) \]

    if 1.05e199 < M

    1. Initial program 79.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. Simplified79.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Taylor expanded in d around 0 35.2%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    4. Step-by-step derivation
      1. associate-/l*35.2%

        \[\leadsto -0.125 \cdot \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      2. unpow235.2%

        \[\leadsto -0.125 \cdot \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      3. unpow235.2%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
    5. Simplified35.2%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 3.7 \cdot 10^{-99}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;M \leq 1.05 \cdot 10^{+199}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{D \cdot D}{\frac{d}{M \cdot M}}\right)\\ \end{array} \]

Alternative 18: 43.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -2.5 \cdot 10^{-255} \lor \neg \left(d \leq 1.75 \cdot 10^{-158}\right) \land d \leq 1.25 \cdot 10^{+76}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (or (<= d -2.5e-255) (and (not (<= d 1.75e-158)) (<= d 1.25e+76)))
   (*
    (sqrt (* (/ d l) (/ d h)))
    (+ 1.0 (* -0.5 (* 0.25 (* (/ (* D D) l) (/ (* h (* M M)) (* d d)))))))
   (/ d (* (sqrt l) (sqrt h)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if ((d <= -2.5e-255) || (!(d <= 1.75e-158) && (d <= 1.25e+76))) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	} else {
		tmp = d / (sqrt(l) * sqrt(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 ((d <= (-2.5d-255)) .or. (.not. (d <= 1.75d-158)) .and. (d <= 1.25d+76)) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (0.25d0 * (((d_1 * d_1) / l) * ((h * (m * m)) / (d * d))))))
    else
        tmp = d / (sqrt(l) * sqrt(h))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if ((d <= -2.5e-255) || (!(d <= 1.75e-158) && (d <= 1.25e+76))) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	} else {
		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if (d <= -2.5e-255) or (not (d <= 1.75e-158) and (d <= 1.25e+76)):
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))))
	else:
		tmp = d / (math.sqrt(l) * math.sqrt(h))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if ((d <= -2.5e-255) || (!(d <= 1.75e-158) && (d <= 1.25e+76)))
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * Float64(Float64(Float64(D * D) / l) * Float64(Float64(h * Float64(M * M)) / Float64(d * d)))))));
	else
		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if ((d <= -2.5e-255) || (~((d <= 1.75e-158)) && (d <= 1.25e+76)))
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	else
		tmp = d / (sqrt(l) * sqrt(h));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[Or[LessEqual[d, -2.5e-255], And[N[Not[LessEqual[d, 1.75e-158]], $MachinePrecision], LessEqual[d, 1.25e+76]]], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.5 \cdot 10^{-255} \lor \neg \left(d \leq 1.75 \cdot 10^{-158}\right) \land d \leq 1.25 \cdot 10^{+76}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -2.4999999999999998e-255 or 1.75000000000000006e-158 < d < 1.24999999999999998e76

    1. Initial program 79.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified79.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u39.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\right)} \]
      2. expm1-udef29.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} - 1} \]
    4. Applied egg-rr25.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def33.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p67.1%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \]
      3. rem-log-exp61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\log \left(e^{1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      4. exp-sum61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \log \color{blue}{\left(e^{1} \cdot e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      5. log-prod61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(\log \left(e^{1}\right) + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right)} \]
      6. rem-log-exp61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(\color{blue}{1} + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right) \]
      7. *-commutative61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm161.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
      9. log1p-def61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
    6. Simplified67.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in h around 0 46.3%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
    8. Step-by-step derivation
      1. associate-*r/46.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2} \cdot \ell}}\right) \]
      2. *-commutative46.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}\right)}{{d}^{2} \cdot \ell}\right) \]
      3. associate-*r/46.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
      4. *-commutative46.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}}\right)\right) \]
      5. times-frac48.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)}\right)\right) \]
      6. unpow248.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)\right)\right) \]
      7. *-commutative48.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{h \cdot {M}^{2}}}{{d}^{2}}\right)\right)\right) \]
      8. unpow248.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \color{blue}{\left(M \cdot M\right)}}{{d}^{2}}\right)\right)\right) \]
      9. unpow248.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{d \cdot d}}\right)\right)\right) \]
    9. Simplified48.2%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)}\right) \]

    if -2.4999999999999998e-255 < d < 1.75000000000000006e-158 or 1.24999999999999998e76 < d

    1. Initial program 54.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. Simplified53.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Taylor expanded in d around inf 49.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    4. Step-by-step derivation
      1. pow149.9%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)}^{1}} \]
      2. *-commutative49.9%

        \[\leadsto {\color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}}^{1} \]
      3. sqrt-div49.9%

        \[\leadsto {\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)}^{1} \]
      4. metadata-eval49.9%

        \[\leadsto {\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)}^{1} \]
      5. *-commutative49.9%

        \[\leadsto {\left(d \cdot \frac{1}{\sqrt{\color{blue}{h \cdot \ell}}}\right)}^{1} \]
    5. Applied egg-rr49.9%

      \[\leadsto \color{blue}{{\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    6. Step-by-step derivation
      1. unpow149.9%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      2. associate-*r/50.0%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      3. *-rgt-identity50.0%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    7. Simplified50.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    8. Step-by-step derivation
      1. sqrt-prod54.3%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    9. Applied egg-rr54.3%

      \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.5 \cdot 10^{-255} \lor \neg \left(d \leq 1.75 \cdot 10^{-158}\right) \land d \leq 1.25 \cdot 10^{+76}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]

Alternative 19: 43.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{if}\;d \leq -5 \cdot 10^{-254}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{-156}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+76}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0
         (*
          (sqrt (* (/ d l) (/ d h)))
          (+
           1.0
           (* -0.5 (* 0.25 (* (/ (* D D) l) (/ (* h (* M M)) (* d d)))))))))
   (if (<= d -5e-254)
     t_0
     (if (<= d 7.5e-156)
       (* d (* (pow h -0.5) (pow l -0.5)))
       (if (<= d 1.65e+76) t_0 (/ d (* (sqrt l) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	double tmp;
	if (d <= -5e-254) {
		tmp = t_0;
	} else if (d <= 7.5e-156) {
		tmp = d * (pow(h, -0.5) * pow(l, -0.5));
	} else if (d <= 1.65e+76) {
		tmp = t_0;
	} else {
		tmp = d / (sqrt(l) * sqrt(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) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (0.25d0 * (((d_1 * d_1) / l) * ((h * (m * m)) / (d * d))))))
    if (d <= (-5d-254)) then
        tmp = t_0
    else if (d <= 7.5d-156) then
        tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
    else if (d <= 1.65d+76) then
        tmp = t_0
    else
        tmp = d / (sqrt(l) * sqrt(h))
    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 / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	double tmp;
	if (d <= -5e-254) {
		tmp = t_0;
	} else if (d <= 7.5e-156) {
		tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
	} else if (d <= 1.65e+76) {
		tmp = t_0;
	} else {
		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))))
	tmp = 0
	if d <= -5e-254:
		tmp = t_0
	elif d <= 7.5e-156:
		tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5))
	elif d <= 1.65e+76:
		tmp = t_0
	else:
		tmp = d / (math.sqrt(l) * math.sqrt(h))
	return tmp
function code(d, h, l, M, D)
	t_0 = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * Float64(Float64(Float64(D * D) / l) * Float64(Float64(h * Float64(M * M)) / Float64(d * d)))))))
	tmp = 0.0
	if (d <= -5e-254)
		tmp = t_0;
	elseif (d <= 7.5e-156)
		tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5)));
	elseif (d <= 1.65e+76)
		tmp = t_0;
	else
		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	tmp = 0.0;
	if (d <= -5e-254)
		tmp = t_0;
	elseif (d <= 7.5e-156)
		tmp = d * ((h ^ -0.5) * (l ^ -0.5));
	elseif (d <= 1.65e+76)
		tmp = t_0;
	else
		tmp = d / (sqrt(l) * sqrt(h));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5e-254], t$95$0, If[LessEqual[d, 7.5e-156], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.65e+76], t$95$0, N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\
\mathbf{if}\;d \leq -5 \cdot 10^{-254}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq 7.5 \cdot 10^{-156}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\

\mathbf{elif}\;d \leq 1.65 \cdot 10^{+76}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -5.0000000000000003e-254 or 7.49999999999999959e-156 < d < 1.65e76

    1. Initial program 79.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified79.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u39.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\right)} \]
      2. expm1-udef29.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} - 1} \]
    4. Applied egg-rr25.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def33.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p67.1%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \]
      3. rem-log-exp61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\log \left(e^{1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      4. exp-sum61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \log \color{blue}{\left(e^{1} \cdot e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      5. log-prod61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(\log \left(e^{1}\right) + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right)} \]
      6. rem-log-exp61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(\color{blue}{1} + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right) \]
      7. *-commutative61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm161.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
      9. log1p-def61.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
    6. Simplified67.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in h around 0 46.3%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
    8. Step-by-step derivation
      1. associate-*r/46.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2} \cdot \ell}}\right) \]
      2. *-commutative46.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}\right)}{{d}^{2} \cdot \ell}\right) \]
      3. associate-*r/46.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
      4. *-commutative46.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}}\right)\right) \]
      5. times-frac48.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)}\right)\right) \]
      6. unpow248.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)\right)\right) \]
      7. *-commutative48.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{h \cdot {M}^{2}}}{{d}^{2}}\right)\right)\right) \]
      8. unpow248.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \color{blue}{\left(M \cdot M\right)}}{{d}^{2}}\right)\right)\right) \]
      9. unpow248.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{d \cdot d}}\right)\right)\right) \]
    9. Simplified48.2%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)}\right) \]

    if -5.0000000000000003e-254 < d < 7.49999999999999959e-156

    1. Initial program 32.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. Simplified32.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Taylor expanded in d around inf 28.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    4. Step-by-step derivation
      1. pow1/228.1%

        \[\leadsto \color{blue}{{\left(\frac{1}{\ell \cdot h}\right)}^{0.5}} \cdot d \]
      2. *-commutative28.1%

        \[\leadsto {\left(\frac{1}{\color{blue}{h \cdot \ell}}\right)}^{0.5} \cdot d \]
    5. Applied egg-rr28.1%

      \[\leadsto \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \cdot d \]
    6. Step-by-step derivation
      1. unpow1/228.1%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-128.1%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow28.1%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}} \cdot d \]
      4. rem-sqrt-square28.1%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval28.1%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow28.0%

        \[\leadsto \left|\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}}\right| \cdot d \]
      7. fabs-sqr28.0%

        \[\leadsto \color{blue}{\left({\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \cdot d \]
      8. sqr-pow28.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Simplified28.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    8. Step-by-step derivation
      1. unpow-prod-down31.8%

        \[\leadsto \color{blue}{\left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)} \cdot d \]
    9. Applied egg-rr31.8%

      \[\leadsto \color{blue}{\left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)} \cdot d \]

    if 1.65e76 < d

    1. Initial program 72.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. Simplified70.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Taylor expanded in d around inf 68.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    4. Step-by-step derivation
      1. pow168.1%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)}^{1}} \]
      2. *-commutative68.1%

        \[\leadsto {\color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}}^{1} \]
      3. sqrt-div68.0%

        \[\leadsto {\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)}^{1} \]
      4. metadata-eval68.0%

        \[\leadsto {\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)}^{1} \]
      5. *-commutative68.0%

        \[\leadsto {\left(d \cdot \frac{1}{\sqrt{\color{blue}{h \cdot \ell}}}\right)}^{1} \]
    5. Applied egg-rr68.0%

      \[\leadsto \color{blue}{{\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    6. Step-by-step derivation
      1. unpow168.0%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      2. associate-*r/68.2%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      3. *-rgt-identity68.2%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    7. Simplified68.2%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    8. Step-by-step derivation
      1. sqrt-prod73.0%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    9. Applied egg-rr73.0%

      \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -5 \cdot 10^{-254}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{-156}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+76}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]

Alternative 20: 41.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 3.6 \cdot 10^{-99}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= M 3.6e-99)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (*
    (sqrt (* (/ d l) (/ d h)))
    (+ 1.0 (* -0.5 (* 0.25 (* (/ (* D D) l) (/ (* h (* M M)) (* d d)))))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 3.6e-99) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m <= 3.6d-99) then
        tmp = sqrt((d / l)) * sqrt((d / h))
    else
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (0.25d0 * (((d_1 * d_1) / l) * ((h * (m * m)) / (d * d))))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 3.6e-99) {
		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
	} else {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if M <= 3.6e-99:
		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
	else:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (M <= 3.6e-99)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	else
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * Float64(Float64(Float64(D * D) / l) * Float64(Float64(h * Float64(M * M)) / Float64(d * d)))))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (M <= 3.6e-99)
		tmp = sqrt((d / l)) * sqrt((d / h));
	else
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[M, 3.6e-99], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.6 \cdot 10^{-99}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 3.6000000000000001e-99

    1. Initial program 70.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Taylor expanded in M around 0 47.7%

      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{1}\right) \]

    if 3.6000000000000001e-99 < M

    1. Initial program 67.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. Simplified67.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u27.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\right)} \]
      2. expm1-udef20.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} - 1} \]
    4. Applied egg-rr18.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def24.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p57.8%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \]
      3. rem-log-exp53.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\log \left(e^{1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      4. exp-sum53.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \log \color{blue}{\left(e^{1} \cdot e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      5. log-prod53.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(\log \left(e^{1}\right) + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right)} \]
      6. rem-log-exp53.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(\color{blue}{1} + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right) \]
      7. *-commutative53.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm153.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
      9. log1p-def53.9%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
    6. Simplified57.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in h around 0 42.8%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
    8. Step-by-step derivation
      1. associate-*r/42.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2} \cdot \ell}}\right) \]
      2. *-commutative42.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}\right)}{{d}^{2} \cdot \ell}\right) \]
      3. associate-*r/42.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
      4. *-commutative42.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}}\right)\right) \]
      5. times-frac40.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)}\right)\right) \]
      6. unpow240.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)\right)\right) \]
      7. *-commutative40.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{h \cdot {M}^{2}}}{{d}^{2}}\right)\right)\right) \]
      8. unpow240.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \color{blue}{\left(M \cdot M\right)}}{{d}^{2}}\right)\right)\right) \]
      9. unpow240.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{d \cdot d}}\right)\right)\right) \]
    9. Simplified40.8%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 3.6 \cdot 10^{-99}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \end{array} \]

Alternative 21: 43.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{if}\;d \leq -2.5 \cdot 10^{-186}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 8.5 \cdot 10^{-162}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 2.4 \cdot 10^{+113}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0
         (*
          (sqrt (* (/ d l) (/ d h)))
          (+
           1.0
           (* -0.5 (* 0.25 (* (/ (* D D) l) (/ (* h (* M M)) (* d d)))))))))
   (if (<= d -2.5e-186)
     t_0
     (if (<= d 8.5e-162)
       (/ d (sqrt (* h l)))
       (if (<= d 2.4e+113) t_0 (* d (sqrt (/ (/ 1.0 h) l))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	double tmp;
	if (d <= -2.5e-186) {
		tmp = t_0;
	} else if (d <= 8.5e-162) {
		tmp = d / sqrt((h * l));
	} else if (d <= 2.4e+113) {
		tmp = t_0;
	} else {
		tmp = d * sqrt(((1.0 / h) / l));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (0.25d0 * (((d_1 * d_1) / l) * ((h * (m * m)) / (d * d))))))
    if (d <= (-2.5d-186)) then
        tmp = t_0
    else if (d <= 8.5d-162) then
        tmp = d / sqrt((h * l))
    else if (d <= 2.4d+113) then
        tmp = t_0
    else
        tmp = d * sqrt(((1.0d0 / h) / l))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	double tmp;
	if (d <= -2.5e-186) {
		tmp = t_0;
	} else if (d <= 8.5e-162) {
		tmp = d / Math.sqrt((h * l));
	} else if (d <= 2.4e+113) {
		tmp = t_0;
	} else {
		tmp = d * Math.sqrt(((1.0 / h) / l));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))))
	tmp = 0
	if d <= -2.5e-186:
		tmp = t_0
	elif d <= 8.5e-162:
		tmp = d / math.sqrt((h * l))
	elif d <= 2.4e+113:
		tmp = t_0
	else:
		tmp = d * math.sqrt(((1.0 / h) / l))
	return tmp
function code(d, h, l, M, D)
	t_0 = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * Float64(Float64(Float64(D * D) / l) * Float64(Float64(h * Float64(M * M)) / Float64(d * d)))))))
	tmp = 0.0
	if (d <= -2.5e-186)
		tmp = t_0;
	elseif (d <= 8.5e-162)
		tmp = Float64(d / sqrt(Float64(h * l)));
	elseif (d <= 2.4e+113)
		tmp = t_0;
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D * D) / l) * ((h * (M * M)) / (d * d))))));
	tmp = 0.0;
	if (d <= -2.5e-186)
		tmp = t_0;
	elseif (d <= 8.5e-162)
		tmp = d / sqrt((h * l));
	elseif (d <= 2.4e+113)
		tmp = t_0;
	else
		tmp = d * sqrt(((1.0 / h) / l));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.5e-186], t$95$0, If[LessEqual[d, 8.5e-162], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e+113], t$95$0, N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\
\mathbf{if}\;d \leq -2.5 \cdot 10^{-186}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq 8.5 \cdot 10^{-162}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\

\mathbf{elif}\;d \leq 2.4 \cdot 10^{+113}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -2.5e-186 or 8.49999999999999955e-162 < d < 2.39999999999999983e113

    1. Initial program 79.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified79.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Step-by-step derivation
      1. expm1-log1p-u41.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\right)} \]
      2. expm1-udef29.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} - 1} \]
    4. Applied egg-rr26.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def34.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p67.8%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \]
      3. rem-log-exp62.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\log \left(e^{1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      4. exp-sum62.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \log \color{blue}{\left(e^{1} \cdot e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)} \]
      5. log-prod62.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(\log \left(e^{1}\right) + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right)} \]
      6. rem-log-exp62.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(\color{blue}{1} + \log \left(e^{-0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}\right)\right) \]
      7. *-commutative62.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\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)\right) \]
      8. log1p-expm162.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
      9. log1p-def62.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \log \left(e^{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)} \cdot -0.5}\right)\right) \]
    6. Simplified67.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \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)} \]
    7. Taylor expanded in h around 0 49.4%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
    8. Step-by-step derivation
      1. associate-*r/49.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2} \cdot \ell}}\right) \]
      2. *-commutative49.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}\right)}{{d}^{2} \cdot \ell}\right) \]
      3. associate-*r/49.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right) \]
      4. *-commutative49.4%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}}\right)\right) \]
      5. times-frac50.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)}\right)\right) \]
      6. unpow250.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)\right)\right) \]
      7. *-commutative50.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{h \cdot {M}^{2}}}{{d}^{2}}\right)\right)\right) \]
      8. unpow250.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \color{blue}{\left(M \cdot M\right)}}{{d}^{2}}\right)\right)\right) \]
      9. unpow250.7%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{d \cdot d}}\right)\right)\right) \]
    9. Simplified50.7%

      \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)}\right) \]

    if -2.5e-186 < d < 8.49999999999999955e-162

    1. Initial program 38.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. Simplified37.8%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Taylor expanded in d around inf 28.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    4. Step-by-step derivation
      1. pow128.5%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)}^{1}} \]
      2. *-commutative28.5%

        \[\leadsto {\color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}}^{1} \]
      3. sqrt-div28.5%

        \[\leadsto {\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)}^{1} \]
      4. metadata-eval28.5%

        \[\leadsto {\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)}^{1} \]
      5. *-commutative28.5%

        \[\leadsto {\left(d \cdot \frac{1}{\sqrt{\color{blue}{h \cdot \ell}}}\right)}^{1} \]
    5. Applied egg-rr28.5%

      \[\leadsto \color{blue}{{\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
    6. Step-by-step derivation
      1. unpow128.5%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      2. associate-*r/28.5%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      3. *-rgt-identity28.5%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    7. Simplified28.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]

    if 2.39999999999999983e113 < d

    1. Initial program 72.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.7%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Taylor expanded in d around inf 69.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    4. Step-by-step derivation
      1. *-commutative69.5%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot d \]
      2. *-un-lft-identity69.5%

        \[\leadsto \sqrt{\color{blue}{1 \cdot \frac{1}{h \cdot \ell}}} \cdot d \]
    5. Applied egg-rr69.5%

      \[\leadsto \sqrt{\color{blue}{1 \cdot \frac{1}{h \cdot \ell}}} \cdot d \]
    6. Step-by-step derivation
      1. *-lft-identity69.5%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. associate-/r*71.6%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
    7. Simplified71.6%

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.5 \cdot 10^{-186}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{elif}\;d \leq 8.5 \cdot 10^{-162}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 2.4 \cdot 10^{+113}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \]

Alternative 22: 26.4% accurate, 3.1× speedup?

\[\begin{array}{l} \\ d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
double code(double d, double h, double l, double M, double D) {
	return d * sqrt(((1.0 / l) / h));
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d * sqrt(((1.0d0 / l) / h))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.sqrt(((1.0 / l) / h));
}
def code(d, h, l, M, D):
	return d * math.sqrt(((1.0 / l) / h))
function code(d, h, l, M, D)
	return Float64(d * sqrt(Float64(Float64(1.0 / l) / h)))
end
function tmp = code(d, h, l, M, D)
	tmp = d * sqrt(((1.0 / l) / h));
end
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Derivation
  1. Initial program 69.7%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified69.3%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
  3. Step-by-step derivation
    1. associate-*r/69.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    2. div-inv69.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
    3. metadata-eval69.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot \color{blue}{0.5}\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
  4. Applied egg-rr69.9%

    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
  5. Step-by-step derivation
    1. pow1/269.9%

      \[\leadsto \left(\color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
    2. sqr-pow69.9%

      \[\leadsto \left(\color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{0.5}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{0.5}{2}\right)}\right)} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
    3. pow269.9%

      \[\leadsto \left(\color{blue}{{\left({\left(\frac{d}{h}\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
    4. metadata-eval69.9%

      \[\leadsto \left({\left({\left(\frac{d}{h}\right)}^{\color{blue}{0.25}}\right)}^{2} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
  6. Applied egg-rr69.9%

    \[\leadsto \left(\color{blue}{{\left({\left(\frac{d}{h}\right)}^{0.25}\right)}^{2}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
  7. Taylor expanded in d around inf 26.7%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  8. Step-by-step derivation
    1. *-commutative26.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    2. associate-/r*27.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
  9. Simplified27.1%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  10. Final simplification27.1%

    \[\leadsto d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}} \]

Alternative 23: 26.4% accurate, 3.1× speedup?

\[\begin{array}{l} \\ d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 h) l))))
double code(double d, double h, double l, double M, double D) {
	return d * sqrt(((1.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 * sqrt(((1.0d0 / h) / l))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.sqrt(((1.0 / h) / l));
}
def code(d, h, l, M, D):
	return d * math.sqrt(((1.0 / h) / l))
function code(d, h, l, M, D)
	return Float64(d * sqrt(Float64(Float64(1.0 / h) / l)))
end
function tmp = code(d, h, l, M, D)
	tmp = d * sqrt(((1.0 / h) / l));
end
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Derivation
  1. Initial program 69.7%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified69.3%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
  3. Taylor expanded in d around inf 26.7%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  4. Step-by-step derivation
    1. *-commutative26.7%

      \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot d \]
    2. *-un-lft-identity26.7%

      \[\leadsto \sqrt{\color{blue}{1 \cdot \frac{1}{h \cdot \ell}}} \cdot d \]
  5. Applied egg-rr26.7%

    \[\leadsto \sqrt{\color{blue}{1 \cdot \frac{1}{h \cdot \ell}}} \cdot d \]
  6. Step-by-step derivation
    1. *-lft-identity26.7%

      \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
    2. associate-/r*27.1%

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
  7. Simplified27.1%

    \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
  8. Final simplification27.1%

    \[\leadsto d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}} \]

Alternative 24: 26.1% accurate, 3.2× speedup?

\[\begin{array}{l} \\ \frac{d}{\sqrt{h \cdot \ell}} \end{array} \]
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
double code(double d, double h, double l, double M, double D) {
	return d / sqrt((h * l));
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d / sqrt((h * l))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d / Math.sqrt((h * l));
}
def code(d, h, l, M, D):
	return d / math.sqrt((h * l))
function code(d, h, l, M, D)
	return Float64(d / sqrt(Float64(h * l)))
end
function tmp = code(d, h, l, M, D)
	tmp = d / sqrt((h * l));
end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Derivation
  1. Initial program 69.7%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified69.3%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
  3. Taylor expanded in d around inf 26.7%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  4. Step-by-step derivation
    1. pow126.7%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)}^{1}} \]
    2. *-commutative26.7%

      \[\leadsto {\color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}}^{1} \]
    3. sqrt-div26.7%

      \[\leadsto {\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)}^{1} \]
    4. metadata-eval26.7%

      \[\leadsto {\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)}^{1} \]
    5. *-commutative26.7%

      \[\leadsto {\left(d \cdot \frac{1}{\sqrt{\color{blue}{h \cdot \ell}}}\right)}^{1} \]
  5. Applied egg-rr26.7%

    \[\leadsto \color{blue}{{\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)}^{1}} \]
  6. Step-by-step derivation
    1. unpow126.7%

      \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
    2. associate-*r/26.8%

      \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
    3. *-rgt-identity26.8%

      \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
  7. Simplified26.8%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  8. Final simplification26.8%

    \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]

Reproduce

?
herbie shell --seed 2023309 
(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)))))