Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.2% → 81.4%
Time: 24.9s
Alternatives: 19
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 67.2% 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: 81.4% accurate, 0.5× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := 0.5 \cdot \left(D \cdot \frac{M}{d}\right)\\ t_1 := \sqrt{-d}\\ \mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{t\_1}{\sqrt{-h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\ \mathbf{elif}\;\ell \leq 2.9 \cdot 10^{+158}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 + \frac{-1}{\frac{\ell}{0.5 \cdot \left(h \cdot {t\_0}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot \left(\sqrt{d} \cdot \sqrt{\frac{1}{\ell}}\right)\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot \left(\frac{M \cdot D}{d} \cdot \sqrt{0.5}\right)\right)}{\ell} \cdot \left(t\_0 \cdot \sqrt{0.5}\right)\right)\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* 0.5 (* D (/ M d)))) (t_1 (sqrt (- d))))
   (if (<= l -1e-309)
     (*
      (/ t_1 (sqrt (- h)))
      (*
       (/ t_1 (sqrt (- l)))
       (fma (pow (* 0.5 (* M (/ D d))) 2.0) (* -0.5 (/ h l)) 1.0)))
     (if (<= l 2.9e+158)
       (*
        (* (/ (sqrt d) (sqrt h)) (pow (/ d l) 0.5))
        (+ 1.0 (/ -1.0 (/ l (* 0.5 (* h (pow t_0 2.0)))))))
       (*
        (* (pow (/ d h) 0.5) (* (sqrt d) (sqrt (/ 1.0 l))))
        (-
         1.0
         (*
          (/ (* h (* 0.5 (* (/ (* M D) d) (sqrt 0.5)))) l)
          (* t_0 (sqrt 0.5)))))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 0.5 * (D * (M / d));
	double t_1 = sqrt(-d);
	double tmp;
	if (l <= -1e-309) {
		tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * fma(pow((0.5 * (M * (D / d))), 2.0), (-0.5 * (h / l)), 1.0));
	} else if (l <= 2.9e+158) {
		tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), 0.5)) * (1.0 + (-1.0 / (l / (0.5 * (h * pow(t_0, 2.0))))));
	} else {
		tmp = (pow((d / h), 0.5) * (sqrt(d) * sqrt((1.0 / l)))) * (1.0 - (((h * (0.5 * (((M * D) / d) * sqrt(0.5)))) / l) * (t_0 * sqrt(0.5))));
	}
	return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(0.5 * Float64(D * Float64(M / d)))
	t_1 = sqrt(Float64(-d))
	tmp = 0.0
	if (l <= -1e-309)
		tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(Float64(t_1 / sqrt(Float64(-l))) * fma((Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0)));
	elseif (l <= 2.9e+158)
		tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ 0.5)) * Float64(1.0 + Float64(-1.0 / Float64(l / Float64(0.5 * Float64(h * (t_0 ^ 2.0)))))));
	else
		tmp = Float64(Float64((Float64(d / h) ^ 0.5) * Float64(sqrt(d) * sqrt(Float64(1.0 / l)))) * Float64(1.0 - Float64(Float64(Float64(h * Float64(0.5 * Float64(Float64(Float64(M * D) / d) * sqrt(0.5)))) / l) * Float64(t_0 * sqrt(0.5)))));
	end
	return tmp
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1e-309], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * 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], If[LessEqual[l, 2.9e+158], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-1.0 / N[(l / N[(0.5 * N[(h * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(h * N[(0.5 * N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(t$95$0 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(D \cdot \frac{M}{d}\right)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\

\mathbf{elif}\;\ell \leq 2.9 \cdot 10^{+158}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 + \frac{-1}{\frac{\ell}{0.5 \cdot \left(h \cdot {t\_0}^{2}\right)}}\right)\\

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


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

    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. Simplified73.7%

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < l < 2.90000000000000024e158

    1. Initial program 70.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/71.3%

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

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

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

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

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

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

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

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

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

    if 2.90000000000000024e158 < l

    1. Initial program 54.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative54.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\ \mathbf{elif}\;\ell \leq 2.9 \cdot 10^{+158}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 + \frac{-1}{\frac{\ell}{0.5 \cdot \left(h \cdot {\left(0.5 \cdot \left(D \cdot \frac{M}{d}\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot \left(\sqrt{d} \cdot \sqrt{\frac{1}{\ell}}\right)\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot \left(\frac{M \cdot D}{d} \cdot \sqrt{0.5}\right)\right)}{\ell} \cdot \left(\left(0.5 \cdot \left(D \cdot \frac{M}{d}\right)\right) \cdot \sqrt{0.5}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 77.8% accurate, 0.8× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := {\left(0.5 \cdot \left(D \cdot \frac{M}{d}\right)\right)}^{2}\\ \mathbf{if}\;\ell \leq -11000000000:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + t\_0 \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{h \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot 0.125\right)}{\ell} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 + \frac{-1}{\frac{\ell}{0.5 \cdot \left(h \cdot t\_0\right)}}\right)\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (* 0.5 (* D (/ M d))) 2.0)))
   (if (<= l -11000000000.0)
     (*
      (sqrt (/ d h))
      (* (/ (sqrt (- d)) (sqrt (- l))) (+ 1.0 (* t_0 (/ (* h -0.5) l)))))
     (if (<= l -1e-309)
       (*
        (* d (sqrt (/ 1.0 (* l h))))
        (+ (/ (* h (* (pow (/ (* M D) d) 2.0) 0.125)) l) -1.0))
       (*
        (* (/ (sqrt d) (sqrt h)) (pow (/ d l) 0.5))
        (+ 1.0 (/ -1.0 (/ l (* 0.5 (* h t_0))))))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow((0.5 * (D * (M / d))), 2.0);
	double tmp;
	if (l <= -11000000000.0) {
		tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (t_0 * ((h * -0.5) / l))));
	} else if (l <= -1e-309) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), 0.5)) * (1.0 + (-1.0 / (l / (0.5 * (h * t_0)))));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (0.5d0 * (d_1 * (m / d))) ** 2.0d0
    if (l <= (-11000000000.0d0)) then
        tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0d0 + (t_0 * ((h * (-0.5d0)) / l))))
    else if (l <= (-1d-309)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (((h * ((((m * d_1) / d) ** 2.0d0) * 0.125d0)) / l) + (-1.0d0))
    else
        tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ** 0.5d0)) * (1.0d0 + ((-1.0d0) / (l / (0.5d0 * (h * t_0)))))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow((0.5 * (D * (M / d))), 2.0);
	double tmp;
	if (l <= -11000000000.0) {
		tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 + (t_0 * ((h * -0.5) / l))));
	} else if (l <= -1e-309) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (((h * (Math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = ((Math.sqrt(d) / Math.sqrt(h)) * Math.pow((d / l), 0.5)) * (1.0 + (-1.0 / (l / (0.5 * (h * t_0)))));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	t_0 = math.pow((0.5 * (D * (M / d))), 2.0)
	tmp = 0
	if l <= -11000000000.0:
		tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 + (t_0 * ((h * -0.5) / l))))
	elif l <= -1e-309:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (((h * (math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0)
	else:
		tmp = ((math.sqrt(d) / math.sqrt(h)) * math.pow((d / l), 0.5)) * (1.0 + (-1.0 / (l / (0.5 * (h * t_0)))))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(0.5 * Float64(D * Float64(M / d))) ^ 2.0
	tmp = 0.0
	if (l <= -11000000000.0)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(t_0 * Float64(Float64(h * -0.5) / l)))));
	elseif (l <= -1e-309)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(Float64(h * Float64((Float64(Float64(M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0));
	else
		tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ 0.5)) * Float64(1.0 + Float64(-1.0 / Float64(l / Float64(0.5 * Float64(h * t_0))))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = (0.5 * (D * (M / d))) ^ 2.0;
	tmp = 0.0;
	if (l <= -11000000000.0)
		tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (t_0 * ((h * -0.5) / l))));
	elseif (l <= -1e-309)
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * ((((M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0);
	else
		tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ^ 0.5)) * (1.0 + (-1.0 / (l / (0.5 * (h * t_0)))));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(0.5 * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -11000000000.0], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(t$95$0 * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-1.0 / N[(l / N[(0.5 * N[(h * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(0.5 \cdot \left(D \cdot \frac{M}{d}\right)\right)}^{2}\\
\mathbf{if}\;\ell \leq -11000000000:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + t\_0 \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\

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

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


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

    1. Initial program 66.2%

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

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

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

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

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

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

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

    if -1.1e10 < l < -1.000000000000002e-309

    1. Initial program 78.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/82.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < l

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 76.6% accurate, 0.8× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := D \cdot \frac{M}{d}\\ \mathbf{if}\;\ell \leq -30500000000:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + {\left(0.5 \cdot t\_0\right)}^{2} \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{h \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot 0.125\right)}{\ell} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {t\_0}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* D (/ M d))))
   (if (<= l -30500000000.0)
     (*
      (sqrt (/ d h))
      (*
       (/ (sqrt (- d)) (sqrt (- l)))
       (+ 1.0 (* (pow (* 0.5 t_0) 2.0) (/ (* h -0.5) l)))))
     (if (<= l -1e-309)
       (*
        (* d (sqrt (/ 1.0 (* l h))))
        (+ (/ (* h (* (pow (/ (* M D) d) 2.0) 0.125)) l) -1.0))
       (*
        d
        (/ (+ 1.0 (* h (/ (* -0.125 (pow t_0 2.0)) l))) (sqrt (* l h))))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = D * (M / d);
	double tmp;
	if (l <= -30500000000.0) {
		tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (pow((0.5 * t_0), 2.0) * ((h * -0.5) / l))));
	} else if (l <= -1e-309) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow(t_0, 2.0)) / l))) / sqrt((l * h)));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = d_1 * (m / d)
    if (l <= (-30500000000.0d0)) then
        tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0d0 + (((0.5d0 * t_0) ** 2.0d0) * ((h * (-0.5d0)) / l))))
    else if (l <= (-1d-309)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (((h * ((((m * d_1) / d) ** 2.0d0) * 0.125d0)) / l) + (-1.0d0))
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * (t_0 ** 2.0d0)) / l))) / sqrt((l * h)))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = D * (M / d);
	double tmp;
	if (l <= -30500000000.0) {
		tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 + (Math.pow((0.5 * t_0), 2.0) * ((h * -0.5) / l))));
	} else if (l <= -1e-309) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (((h * (Math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * Math.pow(t_0, 2.0)) / l))) / Math.sqrt((l * h)));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	t_0 = D * (M / d)
	tmp = 0
	if l <= -30500000000.0:
		tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 + (math.pow((0.5 * t_0), 2.0) * ((h * -0.5) / l))))
	elif l <= -1e-309:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (((h * (math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0)
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * math.pow(t_0, 2.0)) / l))) / math.sqrt((l * h)))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(D * Float64(M / d))
	tmp = 0.0
	if (l <= -30500000000.0)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64((Float64(0.5 * t_0) ^ 2.0) * Float64(Float64(h * -0.5) / l)))));
	elseif (l <= -1e-309)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(Float64(h * Float64((Float64(Float64(M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (t_0 ^ 2.0)) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = D * (M / d);
	tmp = 0.0;
	if (l <= -30500000000.0)
		tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (((0.5 * t_0) ^ 2.0) * ((h * -0.5) / l))));
	elseif (l <= -1e-309)
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * ((((M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0);
	else
		tmp = d * ((1.0 + (h * ((-0.125 * (t_0 ^ 2.0)) / l))) / sqrt((l * h)));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -30500000000.0], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(0.5 * t$95$0), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M}{d}\\
\mathbf{if}\;\ell \leq -30500000000:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + {\left(0.5 \cdot t\_0\right)}^{2} \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {t\_0}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\


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

    1. Initial program 66.2%

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

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

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

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

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

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

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

    if -3.05e10 < l < -1.000000000000002e-309

    1. Initial program 78.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/82.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < l

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 75.5% accurate, 0.8× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -6.5 \cdot 10^{-67}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(h, \frac{-0.125}{\ell} \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}, 1\right)\right)\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{h \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot 0.125\right)}{\ell} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -6.5e-67)
   (*
    (sqrt (/ d h))
    (* (sqrt (/ d l)) (fma h (* (/ -0.125 l) (pow (* M (/ D d)) 2.0)) 1.0)))
   (if (<= d -1e-309)
     (*
      (* d (sqrt (/ 1.0 (* l h))))
      (+ (/ (* h (* (pow (/ (* M D) d) 2.0) 0.125)) l) -1.0))
     (*
      d
      (/
       (+ 1.0 (* h (/ (* -0.125 (pow (* D (/ M d)) 2.0)) l)))
       (sqrt (* l h)))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -6.5e-67) {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * fma(h, ((-0.125 / l) * pow((M * (D / d)), 2.0)), 1.0));
	} else if (d <= -1e-309) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow((D * (M / d)), 2.0)) / l))) / sqrt((l * h)));
	}
	return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -6.5e-67)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(h, Float64(Float64(-0.125 / l) * (Float64(M * Float64(D / d)) ^ 2.0)), 1.0)));
	elseif (d <= -1e-309)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(Float64(h * Float64((Float64(Float64(M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -6.5e-67], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(h * N[(N[(-0.125 / l), $MachinePrecision] * N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6.5 \cdot 10^{-67}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(h, \frac{-0.125}{\ell} \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}, 1\right)\right)\\

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

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


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

    1. Initial program 86.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. Simplified88.5%

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

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

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

    if -6.4999999999999997e-67 < d < -1.000000000000002e-309

    1. Initial program 53.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/54.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < d

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 75.2% accurate, 1.0× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := D \cdot \frac{M}{d}\\ \mathbf{if}\;d \leq -1 \cdot 10^{-85}:\\ \;\;\;\;\left(1 + \frac{-1}{\frac{\ell}{0.5 \cdot \left(h \cdot {\left(0.5 \cdot t\_0\right)}^{2}\right)}}\right) \cdot \left({\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{h \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot 0.125\right)}{\ell} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {t\_0}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* D (/ M d))))
   (if (<= d -1e-85)
     (*
      (+ 1.0 (/ -1.0 (/ l (* 0.5 (* h (pow (* 0.5 t_0) 2.0))))))
      (* (pow (/ d h) 0.5) (sqrt (/ d l))))
     (if (<= d -1e-309)
       (*
        (* d (sqrt (/ 1.0 (* l h))))
        (+ (/ (* h (* (pow (/ (* M D) d) 2.0) 0.125)) l) -1.0))
       (*
        d
        (/ (+ 1.0 (* h (/ (* -0.125 (pow t_0 2.0)) l))) (sqrt (* l h))))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = D * (M / d);
	double tmp;
	if (d <= -1e-85) {
		tmp = (1.0 + (-1.0 / (l / (0.5 * (h * pow((0.5 * t_0), 2.0)))))) * (pow((d / h), 0.5) * sqrt((d / l)));
	} else if (d <= -1e-309) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow(t_0, 2.0)) / l))) / sqrt((l * h)));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = d_1 * (m / d)
    if (d <= (-1d-85)) then
        tmp = (1.0d0 + ((-1.0d0) / (l / (0.5d0 * (h * ((0.5d0 * t_0) ** 2.0d0)))))) * (((d / h) ** 0.5d0) * sqrt((d / l)))
    else if (d <= (-1d-309)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (((h * ((((m * d_1) / d) ** 2.0d0) * 0.125d0)) / l) + (-1.0d0))
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * (t_0 ** 2.0d0)) / l))) / sqrt((l * h)))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = D * (M / d);
	double tmp;
	if (d <= -1e-85) {
		tmp = (1.0 + (-1.0 / (l / (0.5 * (h * Math.pow((0.5 * t_0), 2.0)))))) * (Math.pow((d / h), 0.5) * Math.sqrt((d / l)));
	} else if (d <= -1e-309) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (((h * (Math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * Math.pow(t_0, 2.0)) / l))) / Math.sqrt((l * h)));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	t_0 = D * (M / d)
	tmp = 0
	if d <= -1e-85:
		tmp = (1.0 + (-1.0 / (l / (0.5 * (h * math.pow((0.5 * t_0), 2.0)))))) * (math.pow((d / h), 0.5) * math.sqrt((d / l)))
	elif d <= -1e-309:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (((h * (math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0)
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * math.pow(t_0, 2.0)) / l))) / math.sqrt((l * h)))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(D * Float64(M / d))
	tmp = 0.0
	if (d <= -1e-85)
		tmp = Float64(Float64(1.0 + Float64(-1.0 / Float64(l / Float64(0.5 * Float64(h * (Float64(0.5 * t_0) ^ 2.0)))))) * Float64((Float64(d / h) ^ 0.5) * sqrt(Float64(d / l))));
	elseif (d <= -1e-309)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(Float64(h * Float64((Float64(Float64(M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (t_0 ^ 2.0)) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = D * (M / d);
	tmp = 0.0;
	if (d <= -1e-85)
		tmp = (1.0 + (-1.0 / (l / (0.5 * (h * ((0.5 * t_0) ^ 2.0)))))) * (((d / h) ^ 0.5) * sqrt((d / l)));
	elseif (d <= -1e-309)
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * ((((M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0);
	else
		tmp = d * ((1.0 + (h * ((-0.125 * (t_0 ^ 2.0)) / l))) / sqrt((l * h)));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1e-85], N[(N[(1.0 + N[(-1.0 / N[(l / N[(0.5 * N[(h * N[Power[N[(0.5 * t$95$0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M}{d}\\
\mathbf{if}\;d \leq -1 \cdot 10^{-85}:\\
\;\;\;\;\left(1 + \frac{-1}{\frac{\ell}{0.5 \cdot \left(h \cdot {\left(0.5 \cdot t\_0\right)}^{2}\right)}}\right) \cdot \left({\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\frac{d}{\ell}}\right)\\

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

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {t\_0}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\


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

    1. Initial program 86.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/90.2%

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

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

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

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

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

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

    if -9.9999999999999998e-86 < d < -1.000000000000002e-309

    1. Initial program 51.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/51.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < d

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 75.3% accurate, 1.0× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := {\left(\frac{M \cdot D}{d}\right)}^{2}\\ \mathbf{if}\;d \leq -9.2 \cdot 10^{-87}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \left(h \cdot \left(0.5 \cdot \left(t\_0 \cdot 0.25\right)\right)\right) \cdot \frac{-1}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{h \cdot \left(t\_0 \cdot 0.125\right)}{\ell} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (/ (* M D) d) 2.0)))
   (if (<= d -9.2e-87)
     (*
      (sqrt (/ d h))
      (* (sqrt (/ d l)) (+ 1.0 (* (* h (* 0.5 (* t_0 0.25))) (/ -1.0 l)))))
     (if (<= d -1e-309)
       (* (* d (sqrt (/ 1.0 (* l h)))) (+ (/ (* h (* t_0 0.125)) l) -1.0))
       (*
        d
        (/
         (+ 1.0 (* h (/ (* -0.125 (pow (* D (/ M d)) 2.0)) l)))
         (sqrt (* l h))))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow(((M * D) / d), 2.0);
	double tmp;
	if (d <= -9.2e-87) {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h * (0.5 * (t_0 * 0.25))) * (-1.0 / l))));
	} else if (d <= -1e-309) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (t_0 * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow((D * (M / d)), 2.0)) / l))) / sqrt((l * h)));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((m * d_1) / d) ** 2.0d0
    if (d <= (-9.2d-87)) then
        tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((h * (0.5d0 * (t_0 * 0.25d0))) * ((-1.0d0) / l))))
    else if (d <= (-1d-309)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (((h * (t_0 * 0.125d0)) / l) + (-1.0d0))
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)) / l))) / sqrt((l * h)))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow(((M * D) / d), 2.0);
	double tmp;
	if (d <= -9.2e-87) {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((h * (0.5 * (t_0 * 0.25))) * (-1.0 / l))));
	} else if (d <= -1e-309) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (((h * (t_0 * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * Math.pow((D * (M / d)), 2.0)) / l))) / Math.sqrt((l * h)));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	t_0 = math.pow(((M * D) / d), 2.0)
	tmp = 0
	if d <= -9.2e-87:
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((h * (0.5 * (t_0 * 0.25))) * (-1.0 / l))))
	elif d <= -1e-309:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (((h * (t_0 * 0.125)) / l) + -1.0)
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * math.pow((D * (M / d)), 2.0)) / l))) / math.sqrt((l * h)))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(Float64(M * D) / d) ^ 2.0
	tmp = 0.0
	if (d <= -9.2e-87)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h * Float64(0.5 * Float64(t_0 * 0.25))) * Float64(-1.0 / l)))));
	elseif (d <= -1e-309)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(Float64(h * Float64(t_0 * 0.125)) / l) + -1.0));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = ((M * D) / d) ^ 2.0;
	tmp = 0.0;
	if (d <= -9.2e-87)
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h * (0.5 * (t_0 * 0.25))) * (-1.0 / l))));
	elseif (d <= -1e-309)
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (t_0 * 0.125)) / l) + -1.0);
	else
		tmp = d * ((1.0 + (h * ((-0.125 * ((D * (M / d)) ^ 2.0)) / l))) / sqrt((l * h)));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -9.2e-87], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(0.5 * N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * N[(t$95$0 * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -9.2 \cdot 10^{-87}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \left(h \cdot \left(0.5 \cdot \left(t\_0 \cdot 0.25\right)\right)\right) \cdot \frac{-1}{\ell}\right)\right)\\

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

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


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

    1. Initial program 86.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/90.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.2000000000000006e-87 < d < -1.000000000000002e-309

    1. Initial program 51.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/51.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < d

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 74.5% accurate, 1.0× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -4 \cdot 10^{-86}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)\right)\right)\right)\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{h \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot 0.125\right)}{\ell} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -4e-86)
   (*
    (sqrt (/ d h))
    (*
     (sqrt (/ d l))
     (- 1.0 (* 0.5 (* (/ h l) (* 0.25 (pow (/ M (/ d D)) 2.0)))))))
   (if (<= d -1e-309)
     (*
      (* d (sqrt (/ 1.0 (* l h))))
      (+ (/ (* h (* (pow (/ (* M D) d) 2.0) 0.125)) l) -1.0))
     (*
      d
      (/
       (+ 1.0 (* h (/ (* -0.125 (pow (* D (/ M d)) 2.0)) l)))
       (sqrt (* l h)))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -4e-86) {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * (0.25 * pow((M / (d / D)), 2.0))))));
	} else if (d <= -1e-309) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow((D * (M / d)), 2.0)) / l))) / sqrt((l * h)));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= (-4d-86)) then
        tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h / l) * (0.25d0 * ((m / (d / d_1)) ** 2.0d0))))))
    else if (d <= (-1d-309)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (((h * ((((m * d_1) / d) ** 2.0d0) * 0.125d0)) / l) + (-1.0d0))
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)) / l))) / sqrt((l * h)))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -4e-86) {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * (0.25 * Math.pow((M / (d / D)), 2.0))))));
	} else if (d <= -1e-309) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (((h * (Math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * Math.pow((D * (M / d)), 2.0)) / l))) / Math.sqrt((l * h)));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	tmp = 0
	if d <= -4e-86:
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * (0.25 * math.pow((M / (d / D)), 2.0))))))
	elif d <= -1e-309:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (((h * (math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0)
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * math.pow((D * (M / d)), 2.0)) / l))) / math.sqrt((l * h)))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -4e-86)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * Float64(0.25 * (Float64(M / Float64(d / D)) ^ 2.0)))))));
	elseif (d <= -1e-309)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(Float64(h * Float64((Float64(Float64(M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= -4e-86)
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * (0.25 * ((M / (d / D)) ^ 2.0))))));
	elseif (d <= -1e-309)
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * ((((M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0);
	else
		tmp = d * ((1.0 + (h * ((-0.125 * ((D * (M / d)) ^ 2.0)) / l))) / sqrt((l * h)));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -4e-86], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[(0.25 * N[Power[N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4 \cdot 10^{-86}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)\right)\right)\right)\\

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

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


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

    1. Initial program 86.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. Add Preprocessing
    3. Step-by-step derivation
      1. times-frac88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000034e-86 < d < -1.000000000000002e-309

    1. Initial program 51.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/51.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < d

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 75.2% accurate, 1.0× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := {\left(D \cdot \frac{M}{d}\right)}^{2}\\ \mathbf{if}\;\ell \leq -9.5 \cdot 10^{+150}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot t\_0\right)\right)\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{h \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot 0.125\right)}{\ell} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot t\_0}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (* D (/ M d)) 2.0)))
   (if (<= l -9.5e+150)
     (* (sqrt (/ d l)) (* (sqrt (/ d h)) (+ 1.0 (* -0.125 (* (/ h l) t_0)))))
     (if (<= l -1e-309)
       (*
        (* d (sqrt (/ 1.0 (* l h))))
        (+ (/ (* h (* (pow (/ (* M D) d) 2.0) 0.125)) l) -1.0))
       (* d (/ (+ 1.0 (* h (/ (* -0.125 t_0) l))) (sqrt (* l h))))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow((D * (M / d)), 2.0);
	double tmp;
	if (l <= -9.5e+150) {
		tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (-0.125 * ((h / l) * t_0))));
	} else if (l <= -1e-309) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * t_0) / l))) / sqrt((l * h)));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (d_1 * (m / d)) ** 2.0d0
    if (l <= (-9.5d+150)) then
        tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((-0.125d0) * ((h / l) * t_0))))
    else if (l <= (-1d-309)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (((h * ((((m * d_1) / d) ** 2.0d0) * 0.125d0)) / l) + (-1.0d0))
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * t_0) / l))) / sqrt((l * h)))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow((D * (M / d)), 2.0);
	double tmp;
	if (l <= -9.5e+150) {
		tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (-0.125 * ((h / l) * t_0))));
	} else if (l <= -1e-309) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (((h * (Math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * t_0) / l))) / Math.sqrt((l * h)));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	t_0 = math.pow((D * (M / d)), 2.0)
	tmp = 0
	if l <= -9.5e+150:
		tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (-0.125 * ((h / l) * t_0))))
	elif l <= -1e-309:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (((h * (math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0)
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * t_0) / l))) / math.sqrt((l * h)))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(D * Float64(M / d)) ^ 2.0
	tmp = 0.0
	if (l <= -9.5e+150)
		tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * t_0)))));
	elseif (l <= -1e-309)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(Float64(h * Float64((Float64(Float64(M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * t_0) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = (D * (M / d)) ^ 2.0;
	tmp = 0.0;
	if (l <= -9.5e+150)
		tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (-0.125 * ((h / l) * t_0))));
	elseif (l <= -1e-309)
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * ((((M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0);
	else
		tmp = d * ((1.0 + (h * ((-0.125 * t_0) / l))) / sqrt((l * h)));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -9.5e+150], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d}\right)}^{2}\\
\mathbf{if}\;\ell \leq -9.5 \cdot 10^{+150}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot t\_0\right)\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot t\_0}{\ell}}{\sqrt{\ell \cdot h}}\\


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

    1. Initial program 64.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/65.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000001e150 < l < -1.000000000000002e-309

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/78.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < l

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 75.1% accurate, 1.0× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := {\left(\frac{M \cdot D}{d}\right)}^{2}\\ \mathbf{if}\;\ell \leq -8.5 \cdot 10^{+147}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - t\_0 \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right)\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{h \cdot \left(t\_0 \cdot 0.125\right)}{\ell} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (/ (* M D) d) 2.0)))
   (if (<= l -8.5e+147)
     (* (sqrt (/ d h)) (* (sqrt (/ d l)) (- 1.0 (* t_0 (* (/ h l) 0.125)))))
     (if (<= l -1e-309)
       (* (* d (sqrt (/ 1.0 (* l h)))) (+ (/ (* h (* t_0 0.125)) l) -1.0))
       (*
        d
        (/
         (+ 1.0 (* h (/ (* -0.125 (pow (* D (/ M d)) 2.0)) l)))
         (sqrt (* l h))))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow(((M * D) / d), 2.0);
	double tmp;
	if (l <= -8.5e+147) {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (t_0 * ((h / l) * 0.125))));
	} else if (l <= -1e-309) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (t_0 * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow((D * (M / d)), 2.0)) / l))) / sqrt((l * h)));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((m * d_1) / d) ** 2.0d0
    if (l <= (-8.5d+147)) then
        tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (t_0 * ((h / l) * 0.125d0))))
    else if (l <= (-1d-309)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (((h * (t_0 * 0.125d0)) / l) + (-1.0d0))
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)) / l))) / sqrt((l * h)))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow(((M * D) / d), 2.0);
	double tmp;
	if (l <= -8.5e+147) {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (t_0 * ((h / l) * 0.125))));
	} else if (l <= -1e-309) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (((h * (t_0 * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * Math.pow((D * (M / d)), 2.0)) / l))) / Math.sqrt((l * h)));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	t_0 = math.pow(((M * D) / d), 2.0)
	tmp = 0
	if l <= -8.5e+147:
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (t_0 * ((h / l) * 0.125))))
	elif l <= -1e-309:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (((h * (t_0 * 0.125)) / l) + -1.0)
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * math.pow((D * (M / d)), 2.0)) / l))) / math.sqrt((l * h)))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(Float64(M * D) / d) ^ 2.0
	tmp = 0.0
	if (l <= -8.5e+147)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(t_0 * Float64(Float64(h / l) * 0.125)))));
	elseif (l <= -1e-309)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(Float64(h * Float64(t_0 * 0.125)) / l) + -1.0));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = ((M * D) / d) ^ 2.0;
	tmp = 0.0;
	if (l <= -8.5e+147)
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (t_0 * ((h / l) * 0.125))));
	elseif (l <= -1e-309)
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (t_0 * 0.125)) / l) + -1.0);
	else
		tmp = d * ((1.0 + (h * ((-0.125 * ((D * (M / d)) ^ 2.0)) / l))) / sqrt((l * h)));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -8.5e+147], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * N[(t$95$0 * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D}{d}\right)}^{2}\\
\mathbf{if}\;\ell \leq -8.5 \cdot 10^{+147}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - t\_0 \cdot \left(\frac{h}{\ell} \cdot 0.125\right)\right)\right)\\

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

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


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

    1. Initial program 64.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/65.5%

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

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

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

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

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

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

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

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

    if -8.5000000000000007e147 < l < -1.000000000000002e-309

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/78.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < l

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 75.1% accurate, 1.4× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -6 \cdot 10^{+259}:\\ \;\;\;\;\left(1 - \left(h \cdot \frac{0.125}{\ell}\right) \cdot {\left(\frac{\frac{d}{D}}{M}\right)}^{-2}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(\frac{h \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot 0.125\right)}{\ell} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -6e+259)
   (*
    (- 1.0 (* (* h (/ 0.125 l)) (pow (/ (/ d D) M) -2.0)))
    (sqrt (* (/ d l) (/ d h))))
   (if (<= l -1e-309)
     (*
      (* d (sqrt (/ 1.0 (* l h))))
      (+ (/ (* h (* (pow (/ (* M D) d) 2.0) 0.125)) l) -1.0))
     (*
      d
      (/
       (+ 1.0 (* h (/ (* -0.125 (pow (* D (/ M d)) 2.0)) l)))
       (sqrt (* l h)))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -6e+259) {
		tmp = (1.0 - ((h * (0.125 / l)) * pow(((d / D) / M), -2.0))) * sqrt(((d / l) * (d / h)));
	} else if (l <= -1e-309) {
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * (pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow((D * (M / d)), 2.0)) / l))) / sqrt((l * h)));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-6d+259)) then
        tmp = (1.0d0 - ((h * (0.125d0 / l)) * (((d / d_1) / m) ** (-2.0d0)))) * sqrt(((d / l) * (d / h)))
    else if (l <= (-1d-309)) then
        tmp = (d * sqrt((1.0d0 / (l * h)))) * (((h * ((((m * d_1) / d) ** 2.0d0) * 0.125d0)) / l) + (-1.0d0))
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)) / l))) / sqrt((l * h)))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -6e+259) {
		tmp = (1.0 - ((h * (0.125 / l)) * Math.pow(((d / D) / M), -2.0))) * Math.sqrt(((d / l) * (d / h)));
	} else if (l <= -1e-309) {
		tmp = (d * Math.sqrt((1.0 / (l * h)))) * (((h * (Math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0);
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * Math.pow((D * (M / d)), 2.0)) / l))) / Math.sqrt((l * h)));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -6e+259:
		tmp = (1.0 - ((h * (0.125 / l)) * math.pow(((d / D) / M), -2.0))) * math.sqrt(((d / l) * (d / h)))
	elif l <= -1e-309:
		tmp = (d * math.sqrt((1.0 / (l * h)))) * (((h * (math.pow(((M * D) / d), 2.0) * 0.125)) / l) + -1.0)
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * math.pow((D * (M / d)), 2.0)) / l))) / math.sqrt((l * h)))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -6e+259)
		tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.125 / l)) * (Float64(Float64(d / D) / M) ^ -2.0))) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	elseif (l <= -1e-309)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(Float64(h * Float64((Float64(Float64(M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -6e+259)
		tmp = (1.0 - ((h * (0.125 / l)) * (((d / D) / M) ^ -2.0))) * sqrt(((d / l) * (d / h)));
	elseif (l <= -1e-309)
		tmp = (d * sqrt((1.0 / (l * h)))) * (((h * ((((M * D) / d) ^ 2.0) * 0.125)) / l) + -1.0);
	else
		tmp = d * ((1.0 + (h * ((-0.125 * ((D * (M / d)) ^ 2.0)) / l))) / sqrt((l * h)));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6e+259], N[(N[(1.0 - N[(N[(h * N[(0.125 / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(d / D), $MachinePrecision] / M), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6 \cdot 10^{+259}:\\
\;\;\;\;\left(1 - \left(h \cdot \frac{0.125}{\ell}\right) \cdot {\left(\frac{\frac{d}{D}}{M}\right)}^{-2}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

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

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


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

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.00000000000000026e259 < l < -1.000000000000002e-309

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/75.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < l

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 57.9% accurate, 1.4× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;\ell \leq -1.5 \cdot 10^{-226}:\\ \;\;\;\;{\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{d}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}}{t\_0}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (* l h))))
   (if (<= l -1.5e-226)
     (* (pow (/ d h) 0.5) (sqrt (/ d l)))
     (if (<= l -1e-309)
       (/ d t_0)
       (* d (/ (+ 1.0 (* h (/ (* -0.125 (pow (* D (/ M d)) 2.0)) l))) t_0))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((l * h));
	double tmp;
	if (l <= -1.5e-226) {
		tmp = pow((d / h), 0.5) * sqrt((d / l));
	} else if (l <= -1e-309) {
		tmp = d / t_0;
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow((D * (M / d)), 2.0)) / l))) / t_0);
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((l * h))
    if (l <= (-1.5d-226)) then
        tmp = ((d / h) ** 0.5d0) * sqrt((d / l))
    else if (l <= (-1d-309)) then
        tmp = d / t_0
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)) / l))) / t_0)
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((l * h));
	double tmp;
	if (l <= -1.5e-226) {
		tmp = Math.pow((d / h), 0.5) * Math.sqrt((d / l));
	} else if (l <= -1e-309) {
		tmp = d / t_0;
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * Math.pow((D * (M / d)), 2.0)) / l))) / t_0);
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((l * h))
	tmp = 0
	if l <= -1.5e-226:
		tmp = math.pow((d / h), 0.5) * math.sqrt((d / l))
	elif l <= -1e-309:
		tmp = d / t_0
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * math.pow((D * (M / d)), 2.0)) / l))) / t_0)
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(l * h))
	tmp = 0.0
	if (l <= -1.5e-226)
		tmp = Float64((Float64(d / h) ^ 0.5) * sqrt(Float64(d / l)));
	elseif (l <= -1e-309)
		tmp = Float64(d / t_0);
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)) / l))) / t_0));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((l * h));
	tmp = 0.0;
	if (l <= -1.5e-226)
		tmp = ((d / h) ^ 0.5) * sqrt((d / l));
	elseif (l <= -1e-309)
		tmp = d / t_0;
	else
		tmp = d * ((1.0 + (h * ((-0.125 * ((D * (M / d)) ^ 2.0)) / l))) / t_0);
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.5e-226], N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(d / t$95$0), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -1.5 \cdot 10^{-226}:\\
\;\;\;\;{\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{d}{t\_0}\\

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


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

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

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

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

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

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

    if -1.49999999999999998e-226 < l < -1.000000000000002e-309

    1. Initial program 89.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. Simplified89.3%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/221.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr21.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{d}^{\color{blue}{1}}}{\sqrt{h \cdot \ell}} \]
      7. pow158.5%

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

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

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

    if -1.000000000000002e-309 < l

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 64.6% accurate, 1.5× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq 5.6 \cdot 10^{-146}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot 0.125\right)}{\ell}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= h 5.6e-146)
   (*
    (- 1.0 (/ (* h (* (pow (/ (* M D) d) 2.0) 0.125)) l))
    (sqrt (* (/ d l) (/ d h))))
   (*
    d
    (/
     (+ 1.0 (* h (/ (* -0.125 (pow (* D (/ M d)) 2.0)) l)))
     (sqrt (* l h))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= 5.6e-146) {
		tmp = (1.0 - ((h * (pow(((M * D) / d), 2.0) * 0.125)) / l)) * sqrt(((d / l) * (d / h)));
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow((D * (M / d)), 2.0)) / l))) / sqrt((l * h)));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (h <= 5.6d-146) then
        tmp = (1.0d0 - ((h * ((((m * d_1) / d) ** 2.0d0) * 0.125d0)) / l)) * sqrt(((d / l) * (d / h)))
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)) / l))) / sqrt((l * h)))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= 5.6e-146) {
		tmp = (1.0 - ((h * (Math.pow(((M * D) / d), 2.0) * 0.125)) / l)) * Math.sqrt(((d / l) * (d / h)));
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * Math.pow((D * (M / d)), 2.0)) / l))) / Math.sqrt((l * h)));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	tmp = 0
	if h <= 5.6e-146:
		tmp = (1.0 - ((h * (math.pow(((M * D) / d), 2.0) * 0.125)) / l)) * math.sqrt(((d / l) * (d / h)))
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * math.pow((D * (M / d)), 2.0)) / l))) / math.sqrt((l * h)))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (h <= 5.6e-146)
		tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64((Float64(Float64(M * D) / d) ^ 2.0) * 0.125)) / l)) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (h <= 5.6e-146)
		tmp = (1.0 - ((h * ((((M * D) / d) ^ 2.0) * 0.125)) / l)) * sqrt(((d / l) * (d / h)));
	else
		tmp = d * ((1.0 + (h * ((-0.125 * ((D * (M / d)) ^ 2.0)) / l))) / sqrt((l * h)));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[h, 5.6e-146], N[(N[(1.0 - N[(N[(h * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 5.6 \cdot 10^{-146}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot 0.125\right)}{\ell}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

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


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

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.60000000000000006e-146 < h

    1. Initial program 64.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 65.4% accurate, 1.5× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.75 \cdot 10^{-289}:\\ \;\;\;\;\left(1 - \left(h \cdot \frac{0.125}{\ell}\right) \cdot {\left(\frac{\frac{d}{D}}{M}\right)}^{-2}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1 + h \cdot \frac{-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -1.75e-289)
   (*
    (- 1.0 (* (* h (/ 0.125 l)) (pow (/ (/ d D) M) -2.0)))
    (sqrt (* (/ d l) (/ d h))))
   (*
    d
    (/
     (+ 1.0 (* h (/ (* -0.125 (pow (* D (/ M d)) 2.0)) l)))
     (sqrt (* l h))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.75e-289) {
		tmp = (1.0 - ((h * (0.125 / l)) * pow(((d / D) / M), -2.0))) * sqrt(((d / l) * (d / h)));
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * pow((D * (M / d)), 2.0)) / l))) / sqrt((l * h)));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= (-1.75d-289)) then
        tmp = (1.0d0 - ((h * (0.125d0 / l)) * (((d / d_1) / m) ** (-2.0d0)))) * sqrt(((d / l) * (d / h)))
    else
        tmp = d * ((1.0d0 + (h * (((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)) / l))) / sqrt((l * h)))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.75e-289) {
		tmp = (1.0 - ((h * (0.125 / l)) * Math.pow(((d / D) / M), -2.0))) * Math.sqrt(((d / l) * (d / h)));
	} else {
		tmp = d * ((1.0 + (h * ((-0.125 * Math.pow((D * (M / d)), 2.0)) / l))) / Math.sqrt((l * h)));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	tmp = 0
	if d <= -1.75e-289:
		tmp = (1.0 - ((h * (0.125 / l)) * math.pow(((d / D) / M), -2.0))) * math.sqrt(((d / l) * (d / h)))
	else:
		tmp = d * ((1.0 + (h * ((-0.125 * math.pow((D * (M / d)), 2.0)) / l))) / math.sqrt((l * h)))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -1.75e-289)
		tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.125 / l)) * (Float64(Float64(d / D) / M) ^ -2.0))) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	else
		tmp = Float64(d * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)) / l))) / sqrt(Float64(l * h))));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= -1.75e-289)
		tmp = (1.0 - ((h * (0.125 / l)) * (((d / D) / M) ^ -2.0))) * sqrt(((d / l) * (d / h)));
	else
		tmp = d * ((1.0 + (h * ((-0.125 * ((D * (M / d)) ^ 2.0)) / l))) / sqrt((l * h)));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.75e-289], N[(N[(1.0 - N[(N[(h * N[(0.125 / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(d / D), $MachinePrecision] / M), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(h * N[(N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.75 \cdot 10^{-289}:\\
\;\;\;\;\left(1 - \left(h \cdot \frac{0.125}{\ell}\right) \cdot {\left(\frac{\frac{d}{D}}{M}\right)}^{-2}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

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


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

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/79.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.75e-289 < d

    1. Initial program 63.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 44.9% accurate, 1.5× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.1 \cdot 10^{+155}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -2.5 \cdot 10^{-229}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{elif}\;\ell \leq 3.8 \cdot 10^{-298}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{\ell \cdot h}}{d}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -2.1e+155)
   (sqrt (* (/ d l) (/ d h)))
   (if (<= l -2.5e-229)
     (* d (- (sqrt (/ 1.0 (* l h)))))
     (if (<= l 3.8e-298)
       (/ 1.0 (/ (sqrt (* l h)) d))
       (/ (/ d (sqrt l)) (sqrt h))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.1e+155) {
		tmp = sqrt(((d / l) * (d / h)));
	} else if (l <= -2.5e-229) {
		tmp = d * -sqrt((1.0 / (l * h)));
	} else if (l <= 3.8e-298) {
		tmp = 1.0 / (sqrt((l * h)) / d);
	} else {
		tmp = (d / sqrt(l)) / sqrt(h);
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-2.1d+155)) then
        tmp = sqrt(((d / l) * (d / h)))
    else if (l <= (-2.5d-229)) then
        tmp = d * -sqrt((1.0d0 / (l * h)))
    else if (l <= 3.8d-298) then
        tmp = 1.0d0 / (sqrt((l * h)) / d)
    else
        tmp = (d / sqrt(l)) / sqrt(h)
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.1e+155) {
		tmp = Math.sqrt(((d / l) * (d / h)));
	} else if (l <= -2.5e-229) {
		tmp = d * -Math.sqrt((1.0 / (l * h)));
	} else if (l <= 3.8e-298) {
		tmp = 1.0 / (Math.sqrt((l * h)) / d);
	} else {
		tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -2.1e+155:
		tmp = math.sqrt(((d / l) * (d / h)))
	elif l <= -2.5e-229:
		tmp = d * -math.sqrt((1.0 / (l * h)))
	elif l <= 3.8e-298:
		tmp = 1.0 / (math.sqrt((l * h)) / d)
	else:
		tmp = (d / math.sqrt(l)) / math.sqrt(h)
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -2.1e+155)
		tmp = sqrt(Float64(Float64(d / l) * Float64(d / h)));
	elseif (l <= -2.5e-229)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h)))));
	elseif (l <= 3.8e-298)
		tmp = Float64(1.0 / Float64(sqrt(Float64(l * h)) / d));
	else
		tmp = Float64(Float64(d / sqrt(l)) / sqrt(h));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -2.1e+155)
		tmp = sqrt(((d / l) * (d / h)));
	elseif (l <= -2.5e-229)
		tmp = d * -sqrt((1.0 / (l * h)));
	elseif (l <= 3.8e-298)
		tmp = 1.0 / (sqrt((l * h)) / d);
	else
		tmp = (d / sqrt(l)) / sqrt(h);
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.1e+155], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -2.5e-229], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 3.8e-298], N[(1.0 / N[(N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{+155}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

\mathbf{elif}\;\ell \leq -2.5 \cdot 10^{-229}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\

\mathbf{elif}\;\ell \leq 3.8 \cdot 10^{-298}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\ell \cdot h}}{d}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.1e155

    1. Initial program 62.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. Simplified65.6%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/246.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr46.4%

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

    if -2.1e155 < l < -2.50000000000000008e-229

    1. Initial program 71.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.50000000000000008e-229 < l < 3.8e-298

    1. Initial program 89.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. Simplified89.9%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/225.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr25.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{d}^{\color{blue}{1}}}{\sqrt{h \cdot \ell}} \]
      7. pow160.5%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      8. clear-num60.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}} \]
      9. *-commutative60.5%

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

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

    if 3.8e-298 < l

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/230.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\sqrt{\frac{\color{blue}{{d}^{2}}}{\ell}}}} \]
      5. sqrt-div32.7%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{\ell}}}}} \]
      6. sqrt-pow146.2%

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

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\frac{{d}^{\color{blue}{1}}}{\sqrt{\ell}}}} \]
      8. pow146.2%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\frac{\color{blue}{d}}{\sqrt{\ell}}}} \]
    10. Applied egg-rr46.2%

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

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

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

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h} \cdot \sqrt{\ell}} \]
      4. associate-/l/47.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.1 \cdot 10^{+155}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -2.5 \cdot 10^{-229}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{elif}\;\ell \leq 3.8 \cdot 10^{-298}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{\ell \cdot h}}{d}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 44.8% accurate, 1.5× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -9 \cdot 10^{-227}:\\ \;\;\;\;{\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -9e-227)
   (* (pow (/ d h) 0.5) (sqrt (/ d l)))
   (if (<= l -1e-309) (/ d (sqrt (* l h))) (/ (/ d (sqrt l)) (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -9e-227) {
		tmp = pow((d / h), 0.5) * sqrt((d / l));
	} else if (l <= -1e-309) {
		tmp = d / sqrt((l * h));
	} else {
		tmp = (d / sqrt(l)) / sqrt(h);
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-9d-227)) then
        tmp = ((d / h) ** 0.5d0) * sqrt((d / l))
    else if (l <= (-1d-309)) then
        tmp = d / sqrt((l * h))
    else
        tmp = (d / sqrt(l)) / sqrt(h)
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -9e-227) {
		tmp = Math.pow((d / h), 0.5) * Math.sqrt((d / l));
	} else if (l <= -1e-309) {
		tmp = d / Math.sqrt((l * h));
	} else {
		tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -9e-227:
		tmp = math.pow((d / h), 0.5) * math.sqrt((d / l))
	elif l <= -1e-309:
		tmp = d / math.sqrt((l * h))
	else:
		tmp = (d / math.sqrt(l)) / math.sqrt(h)
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -9e-227)
		tmp = Float64((Float64(d / h) ^ 0.5) * sqrt(Float64(d / l)));
	elseif (l <= -1e-309)
		tmp = Float64(d / sqrt(Float64(l * h)));
	else
		tmp = Float64(Float64(d / sqrt(l)) / sqrt(h));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -9e-227)
		tmp = ((d / h) ^ 0.5) * sqrt((d / l));
	elseif (l <= -1e-309)
		tmp = d / sqrt((l * h));
	else
		tmp = (d / sqrt(l)) / sqrt(h);
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -9e-227], N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9 \cdot 10^{-227}:\\
\;\;\;\;{\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\frac{d}{\ell}}\\

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

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


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

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

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

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

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

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

    if -8.99999999999999986e-227 < l < -1.000000000000002e-309

    1. Initial program 89.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. Simplified89.3%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/221.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr21.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{d}^{\color{blue}{1}}}{\sqrt{h \cdot \ell}} \]
      7. pow158.5%

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

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

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

    if -1.000000000000002e-309 < l

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/230.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr30.9%

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\sqrt{\frac{\color{blue}{{d}^{2}}}{\ell}}}} \]
      5. sqrt-div33.0%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{\ell}}}}} \]
      6. sqrt-pow146.3%

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

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\frac{{d}^{\color{blue}{1}}}{\sqrt{\ell}}}} \]
      8. pow146.3%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\frac{\color{blue}{d}}{\sqrt{\ell}}}} \]
    10. Applied egg-rr46.3%

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

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

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

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h} \cdot \sqrt{\ell}} \]
      4. associate-/l/47.0%

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

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

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

Alternative 16: 44.8% accurate, 1.5× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.2 \cdot 10^{-227}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{-309}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -2.2e-227)
   (* (sqrt (/ d h)) (sqrt (/ d l)))
   (if (<= l 2e-309) (/ d (sqrt (* l h))) (/ (/ d (sqrt l)) (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.2e-227) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (l <= 2e-309) {
		tmp = d / sqrt((l * h));
	} else {
		tmp = (d / sqrt(l)) / sqrt(h);
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-2.2d-227)) then
        tmp = sqrt((d / h)) * sqrt((d / l))
    else if (l <= 2d-309) then
        tmp = d / sqrt((l * h))
    else
        tmp = (d / sqrt(l)) / sqrt(h)
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.2e-227) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (l <= 2e-309) {
		tmp = d / Math.sqrt((l * h));
	} else {
		tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -2.2e-227:
		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
	elif l <= 2e-309:
		tmp = d / math.sqrt((l * h))
	else:
		tmp = (d / math.sqrt(l)) / math.sqrt(h)
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -2.2e-227)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (l <= 2e-309)
		tmp = Float64(d / sqrt(Float64(l * h)));
	else
		tmp = Float64(Float64(d / sqrt(l)) / sqrt(h));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -2.2e-227)
		tmp = sqrt((d / h)) * sqrt((d / l));
	elseif (l <= 2e-309)
		tmp = d / sqrt((l * h));
	else
		tmp = (d / sqrt(l)) / sqrt(h);
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.2e-227], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2e-309], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{-227}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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

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


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

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

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

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

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

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

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

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

    if -2.19999999999999981e-227 < l < 1.9999999999999988e-309

    1. Initial program 89.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. Simplified89.3%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/221.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr21.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    7. Step-by-step derivation
      1. associate-*l/21.4%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
    8. Applied egg-rr21.4%

      \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
    9. Step-by-step derivation
      1. associate-*l/21.4%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      2. frac-times21.3%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
      3. unpow221.3%

        \[\leadsto \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}} \]
      4. sqrt-div21.3%

        \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
      5. sqrt-pow158.5%

        \[\leadsto \frac{\color{blue}{{d}^{\left(\frac{2}{2}\right)}}}{\sqrt{h \cdot \ell}} \]
      6. metadata-eval58.5%

        \[\leadsto \frac{{d}^{\color{blue}{1}}}{\sqrt{h \cdot \ell}} \]
      7. pow158.5%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      8. *-commutative58.5%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
    10. Applied egg-rr58.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]

    if 1.9999999999999988e-309 < l

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in M around 0 37.7%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. pow1/237.7%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      2. metadata-eval37.7%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      3. *-rgt-identity37.7%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      4. pow1/237.7%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      5. metadata-eval37.7%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \]
      6. pow-prod-down30.9%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}} \]
      7. metadata-eval30.9%

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/230.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr30.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    7. Step-by-step derivation
      1. associate-*l/26.1%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
    8. Applied egg-rr26.1%

      \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
    9. Step-by-step derivation
      1. sqrt-div30.5%

        \[\leadsto \color{blue}{\frac{\sqrt{d \cdot \frac{d}{\ell}}}{\sqrt{h}}} \]
      2. clear-num30.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{h}}{\sqrt{d \cdot \frac{d}{\ell}}}}} \]
      3. associate-*r/24.1%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\sqrt{\color{blue}{\frac{d \cdot d}{\ell}}}}} \]
      4. unpow224.1%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\sqrt{\frac{\color{blue}{{d}^{2}}}{\ell}}}} \]
      5. sqrt-div33.0%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{\ell}}}}} \]
      6. sqrt-pow146.3%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\frac{\color{blue}{{d}^{\left(\frac{2}{2}\right)}}}{\sqrt{\ell}}}} \]
      7. metadata-eval46.3%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\frac{{d}^{\color{blue}{1}}}{\sqrt{\ell}}}} \]
      8. pow146.3%

        \[\leadsto \frac{1}{\frac{\sqrt{h}}{\frac{\color{blue}{d}}{\sqrt{\ell}}}} \]
    10. Applied egg-rr46.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{h}}{\frac{d}{\sqrt{\ell}}}}} \]
    11. Step-by-step derivation
      1. associate-/r/47.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}} \]
      2. times-frac47.8%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      3. *-lft-identity47.8%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h} \cdot \sqrt{\ell}} \]
      4. associate-/l/47.0%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
    12. Simplified47.0%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification48.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.2 \cdot 10^{-227}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{-309}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 41.7% accurate, 2.8× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1 \cdot 10^{+156}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -3.2 \cdot 10^{-227}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -1e+156)
   (sqrt (* (/ d l) (/ d h)))
   (if (<= l -3.2e-227)
     (* d (- (sqrt (/ 1.0 (* l h)))))
     (/ d (sqrt (* l h))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1e+156) {
		tmp = sqrt(((d / l) * (d / h)));
	} else if (l <= -3.2e-227) {
		tmp = d * -sqrt((1.0 / (l * h)));
	} else {
		tmp = d / sqrt((l * h));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-1d+156)) then
        tmp = sqrt(((d / l) * (d / h)))
    else if (l <= (-3.2d-227)) then
        tmp = d * -sqrt((1.0d0 / (l * h)))
    else
        tmp = d / sqrt((l * h))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1e+156) {
		tmp = Math.sqrt(((d / l) * (d / h)));
	} else if (l <= -3.2e-227) {
		tmp = d * -Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = d / Math.sqrt((l * h));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -1e+156:
		tmp = math.sqrt(((d / l) * (d / h)))
	elif l <= -3.2e-227:
		tmp = d * -math.sqrt((1.0 / (l * h)))
	else:
		tmp = d / math.sqrt((l * h))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -1e+156)
		tmp = sqrt(Float64(Float64(d / l) * Float64(d / h)));
	elseif (l <= -3.2e-227)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h)))));
	else
		tmp = Float64(d / sqrt(Float64(l * h)));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -1e+156)
		tmp = sqrt(((d / l) * (d / h)));
	elseif (l <= -3.2e-227)
		tmp = d * -sqrt((1.0 / (l * h)));
	else
		tmp = d / sqrt((l * h));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1e+156], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -3.2e-227], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{+156}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

\mathbf{elif}\;\ell \leq -3.2 \cdot 10^{-227}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -9.9999999999999998e155

    1. Initial program 62.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. Simplified65.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in M around 0 48.9%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. pow1/249.0%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      2. metadata-eval49.0%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      3. *-rgt-identity49.0%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      4. pow1/249.0%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      5. metadata-eval49.0%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \]
      6. pow-prod-down46.4%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}} \]
      7. metadata-eval46.4%

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/246.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr46.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]

    if -9.9999999999999998e155 < l < -3.2000000000000001e-227

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/75.9%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      2. clear-num76.0%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{\frac{\ell}{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}}}\right) \]
      3. metadata-eval76.0%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{1}{\frac{\ell}{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}}\right) \]
      4. associate-*l*76.0%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{1}{\frac{\ell}{\color{blue}{0.5 \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot h\right)}}}\right) \]
    4. Applied egg-rr77.0%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{\frac{\ell}{0.5 \cdot \left({\left(0.5 \cdot \left(D \cdot \frac{M}{d}\right)\right)}^{2} \cdot h\right)}}}\right) \]
    5. Taylor expanded in l around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      3. *-commutative0.0%

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      4. unpow20.0%

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      5. rem-square-sqrt49.3%

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      6. neg-mul-149.3%

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left(-d\right)} \]
    7. Simplified49.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)} \]

    if -3.2000000000000001e-227 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified69.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in M around 0 35.5%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. pow1/235.5%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      2. metadata-eval35.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      3. *-rgt-identity35.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      4. pow1/235.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      5. metadata-eval35.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \]
      6. pow-prod-down29.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}} \]
      7. metadata-eval29.6%

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/229.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr29.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    7. Step-by-step derivation
      1. associate-*l/25.5%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
    8. Applied egg-rr25.5%

      \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
    9. Step-by-step derivation
      1. associate-*l/29.6%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      2. frac-times23.7%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
      3. unpow223.7%

        \[\leadsto \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}} \]
      4. sqrt-div29.2%

        \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
      5. sqrt-pow145.7%

        \[\leadsto \frac{\color{blue}{{d}^{\left(\frac{2}{2}\right)}}}{\sqrt{h \cdot \ell}} \]
      6. metadata-eval45.7%

        \[\leadsto \frac{{d}^{\color{blue}{1}}}{\sqrt{h \cdot \ell}} \]
      7. pow145.7%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      8. *-commutative45.7%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
    10. Applied egg-rr45.7%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification46.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1 \cdot 10^{+156}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -3.2 \cdot 10^{-227}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 37.9% accurate, 3.0× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.48 \cdot 10^{-227}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -1.48e-227) (sqrt (* (/ d l) (/ d h))) (/ d (sqrt (* l h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.48e-227) {
		tmp = sqrt(((d / l) * (d / h)));
	} else {
		tmp = d / sqrt((l * h));
	}
	return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-1.48d-227)) then
        tmp = sqrt(((d / l) * (d / h)))
    else
        tmp = d / sqrt((l * h))
    end if
    code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.48e-227) {
		tmp = Math.sqrt(((d / l) * (d / h)));
	} else {
		tmp = d / Math.sqrt((l * h));
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -1.48e-227:
		tmp = math.sqrt(((d / l) * (d / h)))
	else:
		tmp = d / math.sqrt((l * h))
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -1.48e-227)
		tmp = sqrt(Float64(Float64(d / l) * Float64(d / h)));
	else
		tmp = Float64(d / sqrt(Float64(l * h)));
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -1.48e-227)
		tmp = sqrt(((d / l) * (d / h)));
	else
		tmp = d / sqrt((l * h));
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.48e-227], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.48 \cdot 10^{-227}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -1.48e-227

    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. Simplified71.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in M around 0 47.5%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. pow1/247.5%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      2. metadata-eval47.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      3. *-rgt-identity47.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      4. pow1/247.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      5. metadata-eval47.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \]
      6. pow-prod-down43.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}} \]
      7. metadata-eval43.6%

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/243.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr43.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]

    if -1.48e-227 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified69.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in M around 0 35.5%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. pow1/235.5%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      2. metadata-eval35.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      3. *-rgt-identity35.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      4. pow1/235.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      5. metadata-eval35.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \]
      6. pow-prod-down29.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}} \]
      7. metadata-eval29.6%

        \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
      8. unpow1/229.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr29.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    7. Step-by-step derivation
      1. associate-*l/25.5%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
    8. Applied egg-rr25.5%

      \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
    9. Step-by-step derivation
      1. associate-*l/29.6%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      2. frac-times23.7%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
      3. unpow223.7%

        \[\leadsto \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}} \]
      4. sqrt-div29.2%

        \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
      5. sqrt-pow145.7%

        \[\leadsto \frac{\color{blue}{{d}^{\left(\frac{2}{2}\right)}}}{\sqrt{h \cdot \ell}} \]
      6. metadata-eval45.7%

        \[\leadsto \frac{{d}^{\color{blue}{1}}}{\sqrt{h \cdot \ell}} \]
      7. pow145.7%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      8. *-commutative45.7%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
    10. Applied egg-rr45.7%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.48 \cdot 10^{-227}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 26.7% accurate, 3.2× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	return d / sqrt((l * h));
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d / sqrt((l * h))
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	return d / Math.sqrt((l * h));
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	return d / math.sqrt((l * h))
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	return Float64(d / sqrt(Float64(l * h)))
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
	tmp = d / sqrt((l * h));
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 69.9%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified70.3%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in M around 0 40.9%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. pow1/240.9%

      \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
    2. metadata-eval40.9%

      \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
    3. *-rgt-identity40.9%

      \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
    4. pow1/240.9%

      \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
    5. metadata-eval40.9%

      \[\leadsto {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \]
    6. pow-prod-down35.9%

      \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}} \]
    7. metadata-eval35.9%

      \[\leadsto {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}} \]
    8. unpow1/235.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
  6. Applied egg-rr35.9%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
  7. Step-by-step derivation
    1. associate-*l/29.7%

      \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
  8. Applied egg-rr29.7%

    \[\leadsto \sqrt{\color{blue}{\frac{d \cdot \frac{d}{\ell}}{h}}} \]
  9. Step-by-step derivation
    1. associate-*l/35.9%

      \[\leadsto \sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    2. frac-times24.9%

      \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
    3. unpow224.9%

      \[\leadsto \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}} \]
    4. sqrt-div28.6%

      \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
    5. sqrt-pow127.4%

      \[\leadsto \frac{\color{blue}{{d}^{\left(\frac{2}{2}\right)}}}{\sqrt{h \cdot \ell}} \]
    6. metadata-eval27.4%

      \[\leadsto \frac{{d}^{\color{blue}{1}}}{\sqrt{h \cdot \ell}} \]
    7. pow127.4%

      \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    8. *-commutative27.4%

      \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
  10. Applied egg-rr27.4%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2024096 
(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)))))