Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.7% → 76.1%
Time: 24.7s
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: 65.7% 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: 76.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := 1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\ t_2 := \sqrt{\frac{d}{h}}\\ t_3 := 1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\\ t_4 := \sqrt{-d}\\ \mathbf{if}\;d \leq -2.2 \cdot 10^{-153}:\\ \;\;\;\;\left(\frac{t\_4}{\sqrt{-h}} \cdot t\_0\right) \cdot t\_1\\ \mathbf{elif}\;d \leq -2.2 \cdot 10^{-260}:\\ \;\;\;\;\frac{t\_4}{\sqrt{-\ell}} \cdot \left(t\_2 \cdot t\_3\right)\\ \mathbf{elif}\;d \leq 8 \cdot 10^{-309}:\\ \;\;\;\;\frac{\mathsf{fma}\left(d, \sqrt{\frac{h}{\ell}}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right)\right)}{h}\\ \mathbf{elif}\;d \leq 3.3 \cdot 10^{-219}:\\ \;\;\;\;t\_0 \cdot \left(t\_3 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(t\_2 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l)))
        (t_1 (- 1.0 (* 0.5 (* h (/ (pow (* D (* 0.5 (/ M d))) 2.0) l)))))
        (t_2 (sqrt (/ d h)))
        (t_3 (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M 2.0) d)) 2.0) -0.5))))
        (t_4 (sqrt (- d))))
   (if (<= d -2.2e-153)
     (* (* (/ t_4 (sqrt (- h))) t_0) t_1)
     (if (<= d -2.2e-260)
       (* (/ t_4 (sqrt (- l))) (* t_2 t_3))
       (if (<= d 8e-309)
         (/
          (fma
           d
           (sqrt (/ h l))
           (* (sqrt (pow (/ h l) 3.0)) (* -0.125 (/ (pow (* D M) 2.0) d))))
          h)
         (if (<= d 3.3e-219)
           (* t_0 (* t_3 (/ (sqrt d) (sqrt h))))
           (* t_1 (* t_2 (/ (sqrt d) (sqrt l))))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = 1.0 - (0.5 * (h * (pow((D * (0.5 * (M / d))), 2.0) / l)));
	double t_2 = sqrt((d / h));
	double t_3 = 1.0 + ((h / l) * (pow((D * ((M / 2.0) / d)), 2.0) * -0.5));
	double t_4 = sqrt(-d);
	double tmp;
	if (d <= -2.2e-153) {
		tmp = ((t_4 / sqrt(-h)) * t_0) * t_1;
	} else if (d <= -2.2e-260) {
		tmp = (t_4 / sqrt(-l)) * (t_2 * t_3);
	} else if (d <= 8e-309) {
		tmp = fma(d, sqrt((h / l)), (sqrt(pow((h / l), 3.0)) * (-0.125 * (pow((D * M), 2.0) / d)))) / h;
	} else if (d <= 3.3e-219) {
		tmp = t_0 * (t_3 * (sqrt(d) / sqrt(h)));
	} else {
		tmp = t_1 * (t_2 * (sqrt(d) / sqrt(l)));
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0) / l))))
	t_2 = sqrt(Float64(d / h))
	t_3 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5)))
	t_4 = sqrt(Float64(-d))
	tmp = 0.0
	if (d <= -2.2e-153)
		tmp = Float64(Float64(Float64(t_4 / sqrt(Float64(-h))) * t_0) * t_1);
	elseif (d <= -2.2e-260)
		tmp = Float64(Float64(t_4 / sqrt(Float64(-l))) * Float64(t_2 * t_3));
	elseif (d <= 8e-309)
		tmp = Float64(fma(d, sqrt(Float64(h / l)), Float64(sqrt((Float64(h / l) ^ 3.0)) * Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d)))) / h);
	elseif (d <= 3.3e-219)
		tmp = Float64(t_0 * Float64(t_3 * Float64(sqrt(d) / sqrt(h))));
	else
		tmp = Float64(t_1 * Float64(t_2 * Float64(sqrt(d) / sqrt(l))));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -2.2e-153], N[(N[(N[(t$95$4 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, -2.2e-260], N[(N[(t$95$4 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8e-309], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 3.3e-219], N[(t$95$0 * N[(t$95$3 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$2 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -2.2 \cdot 10^{-260}:\\
\;\;\;\;\frac{t\_4}{\sqrt{-\ell}} \cdot \left(t\_2 \cdot t\_3\right)\\

\mathbf{elif}\;d \leq 8 \cdot 10^{-309}:\\
\;\;\;\;\frac{\mathsf{fma}\left(d, \sqrt{\frac{h}{\ell}}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right)\right)}{h}\\

\mathbf{elif}\;d \leq 3.3 \cdot 10^{-219}:\\
\;\;\;\;t\_0 \cdot \left(t\_3 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\

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


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

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.20000000000000001e-153 < d < -2.20000000000000017e-260

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

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

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

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

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

    if -2.20000000000000017e-260 < d < 8.0000000000000003e-309

    1. Initial program 25.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. Simplified25.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.0000000000000003e-309 < d < 3.3000000000000002e-219

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

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

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

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

    if 3.3000000000000002e-219 < d

    1. Initial program 74.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 76.1% accurate, 0.8× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-291 < d < 3.19999999999999998e-219

    1. Initial program 36.6%

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

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

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

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

    if 3.19999999999999998e-219 < d

    1. Initial program 74.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 76.1% accurate, 0.8× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-291 < d < 1.6999999999999999e-219

    1. Initial program 36.6%

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

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

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

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

    if 1.6999999999999999e-219 < d

    1. Initial program 74.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 74.2% accurate, 0.8× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-291 < d < 3.89999999999999987e-219

    1. Initial program 36.6%

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

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

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

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

    if 3.89999999999999987e-219 < d

    1. Initial program 74.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 74.2% accurate, 0.8× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-291 < d < 2.29999999999999988e-219

    1. Initial program 36.6%

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

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

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

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

    if 2.29999999999999988e-219 < d

    1. Initial program 74.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 74.1% accurate, 0.8× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-291 < d < 5.1999999999999997e-226

    1. Initial program 30.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. Simplified26.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.1999999999999997e-226 < d

    1. Initial program 74.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. Simplified75.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 h around -inf 60.5%

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

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

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

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

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

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

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

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

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

Alternative 7: 71.2% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-291 < d < 1.04999999999999996e-220

    1. Initial program 30.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. Simplified26.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.04999999999999996e-220 < d

    1. Initial program 74.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. Simplified75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 71.0% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-291 < d < 6.00000000000000035e-220

    1. Initial program 30.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. Simplified26.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.00000000000000035e-220 < d

    1. Initial program 74.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. Simplified75.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 h around -inf 60.5%

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

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

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

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

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

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

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

Alternative 9: 66.3% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-291 < d < 2.6e-220

    1. Initial program 30.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. Simplified26.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.6e-220 < d

    1. Initial program 74.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. Simplified75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 66.2% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-291 < d < 2.7999999999999999e-220

    1. Initial program 30.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. Simplified26.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. Taylor expanded in d around 0 46.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.7999999999999999e-220 < d

    1. Initial program 74.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. Simplified75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 68.7% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 62.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.05000000000000009e-303 < l < 1.1500000000000001e22

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1500000000000001e22 < l

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      2. unpow1/248.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    11. Step-by-step derivation
      1. *-commutative48.7%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down64.1%

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

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

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

Alternative 12: 60.9% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 36.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. Simplified36.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 d around inf 2.5%

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

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

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

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

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

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

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

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

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

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

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

    if -2.3999999999999999e163 < l < 1.9000000000000002e22

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9000000000000002e22 < l

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      2. unpow1/248.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    11. Step-by-step derivation
      1. *-commutative48.7%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down64.1%

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

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

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

Alternative 13: 47.7% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;D \leq 3.8 \cdot 10^{-7}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 3.80000000000000015e-7

    1. Initial program 65.9%

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

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

    if 3.80000000000000015e-7 < D

    1. Initial program 63.4%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. *-commutative66.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{\color{blue}{h \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}}{\ell}\right) \]
      2. associate-/l*70.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)}\right) \]
      3. associate-*r/69.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d \cdot 2}\right)}}^{2}}{\ell}\right)\right) \]
      4. *-rgt-identity69.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{\color{blue}{\left(M \cdot D\right) \cdot 1}}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \]
      5. times-frac69.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{1}{2}\right)}}^{2}}{\ell}\right)\right) \]
      6. metadata-eval69.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{M \cdot D}{d} \cdot \color{blue}{0.5}\right)}^{2}}{\ell}\right)\right) \]
      7. *-commutative69.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{\color{blue}{D \cdot M}}{d} \cdot 0.5\right)}^{2}}{\ell}\right)\right) \]
      8. associate-/l*72.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\left(D \cdot \frac{M}{d}\right)} \cdot 0.5\right)}^{2}}{\ell}\right)\right) \]
      9. associate-*l*72.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}}^{2}}{\ell}\right)\right) \]
    7. Simplified72.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right)}\right) \]
    8. Step-by-step derivation
      1. pow172.1%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right)\right)\right)}^{1}} \]
    9. Applied egg-rr59.1%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(0.5 \cdot h\right) \cdot \frac{{\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2}}{\ell}\right)\right)}^{1}} \]
    10. Step-by-step derivation
      1. unpow159.1%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \left(0.5 \cdot h\right) \cdot \frac{{\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2}}{\ell}\right)} \]
      2. *-commutative59.1%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(0.5 \cdot h\right) \cdot \frac{{\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2}}{\ell}\right) \]
      3. *-commutative59.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(h \cdot 0.5\right)} \cdot \frac{{\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2}}{\ell}\right) \]
      4. associate-/l*62.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(h \cdot 0.5\right) \cdot \frac{{\color{blue}{\left(D \cdot \frac{M \cdot 0.5}{d}\right)}}^{2}}{\ell}\right) \]
      5. *-commutative62.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(h \cdot 0.5\right) \cdot \frac{{\left(D \cdot \frac{\color{blue}{0.5 \cdot M}}{d}\right)}^{2}}{\ell}\right) \]
      6. associate-*r/62.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(h \cdot 0.5\right) \cdot \frac{{\left(D \cdot \color{blue}{\left(0.5 \cdot \frac{M}{d}\right)}\right)}^{2}}{\ell}\right) \]
    11. Simplified62.0%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(h \cdot 0.5\right) \cdot \frac{{\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification49.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq 3.8 \cdot 10^{-7}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(h \cdot 0.5\right) \cdot \frac{{\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 47.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 5 \cdot 10^{-114}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{0.5 \cdot M}{d}\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= M 5e-114)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (*
    (sqrt (* (/ d l) (/ d h)))
    (- 1.0 (* 0.5 (* (/ h l) (pow (* D (/ (* 0.5 M) d)) 2.0)))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 5e-114) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * ((h / l) * pow((D * ((0.5 * M) / d)), 2.0))));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m <= 5d-114) then
        tmp = sqrt((d / l)) * sqrt((d / h))
    else
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (0.5d0 * ((h / l) * ((d_1 * ((0.5d0 * m) / d)) ** 2.0d0))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 5e-114) {
		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
	} else {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * ((h / l) * Math.pow((D * ((0.5 * M) / d)), 2.0))));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if M <= 5e-114:
		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
	else:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * ((h / l) * math.pow((D * ((0.5 * M) / d)), 2.0))))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (M <= 5e-114)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	else
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(D * Float64(Float64(0.5 * M) / d)) ^ 2.0)))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (M <= 5e-114)
		tmp = sqrt((d / l)) * sqrt((d / h));
	else
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * ((h / l) * ((D * ((0.5 * M) / d)) ^ 2.0))));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[M, 5e-114], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(N[(0.5 * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 5 \cdot 10^{-114}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{0.5 \cdot M}{d}\right)}^{2}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 4.99999999999999989e-114

    1. Initial program 65.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. Simplified65.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 d around inf 43.1%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]

    if 4.99999999999999989e-114 < M

    1. Initial program 64.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. Simplified66.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. *-commutative66.6%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. sqrt-unprod57.1%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr57.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in M around 0 54.7%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Step-by-step derivation
      1. associate-*r/54.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{0.5 \cdot \left(D \cdot M\right)}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. *-commutative54.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{0.5 \cdot \color{blue}{\left(M \cdot D\right)}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. associate-*r*54.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{\color{blue}{\left(0.5 \cdot M\right) \cdot D}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. *-commutative54.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{\color{blue}{\left(M \cdot 0.5\right)} \cdot D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. *-commutative54.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*r/57.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(D \cdot \frac{M \cdot 0.5}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    8. Simplified57.1%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(D \cdot \frac{M \cdot 0.5}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 5 \cdot 10^{-114}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{0.5 \cdot M}{d}\right)}^{2}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 46.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq 1.65 \cdot 10^{-250}:\\ \;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d 1.65e-250)
   (* (- d) (pow (* h l) -0.5))
   (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 1.65e-250) {
		tmp = -d * pow((h * l), -0.5);
	} else {
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= 1.65d-250) then
        tmp = -d * ((h * l) ** (-0.5d0))
    else
        tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 1.65e-250) {
		tmp = -d * Math.pow((h * l), -0.5);
	} else {
		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if d <= 1.65e-250:
		tmp = -d * math.pow((h * l), -0.5)
	else:
		tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= 1.65e-250)
		tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= 1.65e-250)
		tmp = -d * ((h * l) ^ -0.5);
	else
		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 1.65e-250], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.65 \cdot 10^{-250}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 1.65e-250

    1. Initial program 59.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. Simplified59.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 d around inf 7.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. associate-/r*0.0%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      3. unpow1/20.0%

        \[\leadsto \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      4. associate-/r*0.0%

        \[\leadsto {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{0.5} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      5. rem-exp-log0.0%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      6. exp-neg0.0%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      7. exp-prod0.0%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      8. distribute-lft-neg-out0.0%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      9. distribute-rgt-neg-in0.0%

        \[\leadsto e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      10. metadata-eval0.0%

        \[\leadsto e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      11. exp-to-pow0.0%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      12. *-commutative0.0%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      13. unpow20.0%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      14. rem-square-sqrt41.6%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      15. neg-mul-141.6%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left(-d\right)} \]
    7. Simplified41.6%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]

    if 1.65e-250 < d

    1. Initial program 73.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified73.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-*r/78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
      2. frac-times78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot h}{\ell}\right) \]
      3. associate-/l*78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(M \cdot \frac{D}{2 \cdot d}\right)}}^{2} \cdot h}{\ell}\right) \]
      4. *-commutative78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(M \cdot \frac{D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot h}{\ell}\right) \]
    5. Applied egg-rr78.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. *-commutative78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{\color{blue}{h \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}}{\ell}\right) \]
      2. associate-/l*80.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)}\right) \]
      3. associate-*r/79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d \cdot 2}\right)}}^{2}}{\ell}\right)\right) \]
      4. *-rgt-identity79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{\color{blue}{\left(M \cdot D\right) \cdot 1}}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \]
      5. times-frac79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{1}{2}\right)}}^{2}}{\ell}\right)\right) \]
      6. metadata-eval79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{M \cdot D}{d} \cdot \color{blue}{0.5}\right)}^{2}}{\ell}\right)\right) \]
      7. *-commutative79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{\color{blue}{D \cdot M}}{d} \cdot 0.5\right)}^{2}}{\ell}\right)\right) \]
      8. associate-/l*80.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\left(D \cdot \frac{M}{d}\right)} \cdot 0.5\right)}^{2}}{\ell}\right)\right) \]
      9. associate-*l*80.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}}^{2}}{\ell}\right)\right) \]
    7. Simplified80.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right)}\right) \]
    8. Taylor expanded in d around inf 41.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    9. Step-by-step derivation
      1. associate-/r*41.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    10. Simplified41.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    11. Step-by-step derivation
      1. sqrt-div52.9%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
    12. Applied egg-rr52.9%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.65 \cdot 10^{-250}:\\ \;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 46.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq 6 \cdot 10^{-251}:\\ \;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d 6e-251)
   (* (- d) (pow (* h l) -0.5))
   (* d (* (pow l -0.5) (pow h -0.5)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 6e-251) {
		tmp = -d * pow((h * l), -0.5);
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= 6d-251) then
        tmp = -d * ((h * l) ** (-0.5d0))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 6e-251) {
		tmp = -d * Math.pow((h * l), -0.5);
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if d <= 6e-251:
		tmp = -d * math.pow((h * l), -0.5)
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= 6e-251)
		tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= 6e-251)
		tmp = -d * ((h * l) ^ -0.5);
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 6e-251], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq 6 \cdot 10^{-251}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 5.9999999999999997e-251

    1. Initial program 59.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. Simplified59.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 d around inf 7.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. associate-/r*0.0%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      3. unpow1/20.0%

        \[\leadsto \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      4. associate-/r*0.0%

        \[\leadsto {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{0.5} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      5. rem-exp-log0.0%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      6. exp-neg0.0%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      7. exp-prod0.0%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      8. distribute-lft-neg-out0.0%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      9. distribute-rgt-neg-in0.0%

        \[\leadsto e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      10. metadata-eval0.0%

        \[\leadsto e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      11. exp-to-pow0.0%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      12. *-commutative0.0%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      13. unpow20.0%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      14. rem-square-sqrt41.6%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      15. neg-mul-141.6%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left(-d\right)} \]
    7. Simplified41.6%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]

    if 5.9999999999999997e-251 < d

    1. Initial program 73.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified73.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-*r/78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
      2. frac-times78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot h}{\ell}\right) \]
      3. associate-/l*78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(M \cdot \frac{D}{2 \cdot d}\right)}}^{2} \cdot h}{\ell}\right) \]
      4. *-commutative78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(M \cdot \frac{D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot h}{\ell}\right) \]
    5. Applied egg-rr78.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. *-commutative78.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{\color{blue}{h \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}}{\ell}\right) \]
      2. associate-/l*80.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)}\right) \]
      3. associate-*r/79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d \cdot 2}\right)}}^{2}}{\ell}\right)\right) \]
      4. *-rgt-identity79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{\color{blue}{\left(M \cdot D\right) \cdot 1}}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \]
      5. times-frac79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{1}{2}\right)}}^{2}}{\ell}\right)\right) \]
      6. metadata-eval79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{M \cdot D}{d} \cdot \color{blue}{0.5}\right)}^{2}}{\ell}\right)\right) \]
      7. *-commutative79.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{\color{blue}{D \cdot M}}{d} \cdot 0.5\right)}^{2}}{\ell}\right)\right) \]
      8. associate-/l*80.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\left(D \cdot \frac{M}{d}\right)} \cdot 0.5\right)}^{2}}{\ell}\right)\right) \]
      9. associate-*l*80.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}}^{2}}{\ell}\right)\right) \]
    7. Simplified80.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right)}\right) \]
    8. Taylor expanded in d around inf 41.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    9. Step-by-step derivation
      1. associate-/r*41.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      2. unpow1/241.4%

        \[\leadsto d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      3. associate-/r*41.4%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{0.5} \]
      4. rem-exp-log39.5%

        \[\leadsto d \cdot {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \]
      5. exp-neg39.5%

        \[\leadsto d \cdot {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \]
      6. exp-prod40.1%

        \[\leadsto d \cdot \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \]
      7. distribute-lft-neg-out40.1%

        \[\leadsto d \cdot e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \]
      8. distribute-rgt-neg-in40.1%

        \[\leadsto d \cdot e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \]
      9. metadata-eval40.1%

        \[\leadsto d \cdot e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \]
      10. exp-to-pow42.0%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    10. Simplified42.0%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    11. Step-by-step derivation
      1. *-commutative42.0%

        \[\leadsto d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \]
      2. unpow-prod-down52.9%

        \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
    12. Applied egg-rr52.9%

      \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 6 \cdot 10^{-251}:\\ \;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 43.4% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq 6.5 \cdot 10^{-251}:\\ \;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d 6.5e-251)
   (* (- d) (pow (* h l) -0.5))
   (* d (/ 1.0 (sqrt (* h l))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 6.5e-251) {
		tmp = -d * pow((h * l), -0.5);
	} else {
		tmp = d * (1.0 / sqrt((h * l)));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= 6.5d-251) then
        tmp = -d * ((h * l) ** (-0.5d0))
    else
        tmp = d * (1.0d0 / sqrt((h * l)))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 6.5e-251) {
		tmp = -d * Math.pow((h * l), -0.5);
	} else {
		tmp = d * (1.0 / Math.sqrt((h * l)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if d <= 6.5e-251:
		tmp = -d * math.pow((h * l), -0.5)
	else:
		tmp = d * (1.0 / math.sqrt((h * l)))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= 6.5e-251)
		tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5));
	else
		tmp = Float64(d * Float64(1.0 / sqrt(Float64(h * l))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= 6.5e-251)
		tmp = -d * ((h * l) ^ -0.5);
	else
		tmp = d * (1.0 / sqrt((h * l)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 6.5e-251], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq 6.5 \cdot 10^{-251}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 6.5000000000000002e-251

    1. Initial program 59.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. Simplified59.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 d around inf 7.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. *-commutative0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
      2. associate-/r*0.0%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      3. unpow1/20.0%

        \[\leadsto \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      4. associate-/r*0.0%

        \[\leadsto {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{0.5} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      5. rem-exp-log0.0%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      6. exp-neg0.0%

        \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      7. exp-prod0.0%

        \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      8. distribute-lft-neg-out0.0%

        \[\leadsto e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      9. distribute-rgt-neg-in0.0%

        \[\leadsto e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      10. metadata-eval0.0%

        \[\leadsto e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      11. exp-to-pow0.0%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      12. *-commutative0.0%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \]
      13. unpow20.0%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      14. rem-square-sqrt41.6%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      15. neg-mul-141.6%

        \[\leadsto {\left(h \cdot \ell\right)}^{-0.5} \cdot \color{blue}{\left(-d\right)} \]
    7. Simplified41.6%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]

    if 6.5000000000000002e-251 < d

    1. Initial program 73.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified73.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 d around inf 41.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div42.0%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval42.0%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
    6. Applied egg-rr42.0%

      \[\leadsto d \cdot \color{blue}{\frac{1}{\sqrt{h \cdot \ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 6.5 \cdot 10^{-251}:\\ \;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 27.4% accurate, 3.1× speedup?

\[\begin{array}{l} \\ d \cdot \frac{1}{\sqrt{h \cdot \ell}} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (/ 1.0 (sqrt (* h l)))))
double code(double d, double h, double l, double M, double D) {
	return d * (1.0 / sqrt((h * l)));
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d * (1.0d0 / sqrt((h * l)))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * (1.0 / Math.sqrt((h * l)));
}
def code(d, h, l, M, D):
	return d * (1.0 / math.sqrt((h * l)))
function code(d, h, l, M, D)
	return Float64(d * Float64(1.0 / sqrt(Float64(h * l))))
end
function tmp = code(d, h, l, M, D)
	tmp = d * (1.0 / sqrt((h * l)));
end
code[d_, h_, l_, M_, D_] := N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot \frac{1}{\sqrt{h \cdot \ell}}
\end{array}
Derivation
  1. Initial program 65.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. 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 d around inf 21.0%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  5. Step-by-step derivation
    1. sqrt-div21.3%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
    2. metadata-eval21.3%

      \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
  6. Applied egg-rr21.3%

    \[\leadsto d \cdot \color{blue}{\frac{1}{\sqrt{h \cdot \ell}}} \]
  7. Add Preprocessing

Alternative 19: 27.4% accurate, 3.1× speedup?

\[\begin{array}{l} \\ d \cdot {\left(h \cdot \ell\right)}^{-0.5} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (pow (* h l) -0.5)))
double code(double d, double h, double l, double M, double D) {
	return d * pow((h * l), -0.5);
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d * ((h * l) ** (-0.5d0))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.pow((h * l), -0.5);
}
def code(d, h, l, M, D):
	return d * math.pow((h * l), -0.5)
function code(d, h, l, M, D)
	return Float64(d * (Float64(h * l) ^ -0.5))
end
function tmp = code(d, h, l, M, D)
	tmp = d * ((h * l) ^ -0.5);
end
code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 65.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. Simplified65.6%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-*r/69.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    2. frac-times69.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot h}{\ell}\right) \]
    3. associate-/l*69.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(M \cdot \frac{D}{2 \cdot d}\right)}}^{2} \cdot h}{\ell}\right) \]
    4. *-commutative69.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(M \cdot \frac{D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot h}{\ell}\right) \]
  5. Applied egg-rr69.5%

    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot h}{\ell}}\right) \]
  6. Step-by-step derivation
    1. *-commutative69.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{\color{blue}{h \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}}{\ell}\right) \]
    2. associate-/l*69.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)}\right) \]
    3. associate-*r/69.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d \cdot 2}\right)}}^{2}}{\ell}\right)\right) \]
    4. *-rgt-identity69.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{\color{blue}{\left(M \cdot D\right) \cdot 1}}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \]
    5. times-frac69.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{1}{2}\right)}}^{2}}{\ell}\right)\right) \]
    6. metadata-eval69.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{M \cdot D}{d} \cdot \color{blue}{0.5}\right)}^{2}}{\ell}\right)\right) \]
    7. *-commutative69.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{\color{blue}{D \cdot M}}{d} \cdot 0.5\right)}^{2}}{\ell}\right)\right) \]
    8. associate-/l*70.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\left(D \cdot \frac{M}{d}\right)} \cdot 0.5\right)}^{2}}{\ell}\right)\right) \]
    9. associate-*l*70.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}}^{2}}{\ell}\right)\right) \]
  7. Simplified70.6%

    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right)}\right) \]
  8. Taylor expanded in d around inf 21.0%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  9. Step-by-step derivation
    1. associate-/r*21.0%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    2. unpow1/221.0%

      \[\leadsto d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
    3. associate-/r*21.0%

      \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{0.5} \]
    4. rem-exp-log20.2%

      \[\leadsto d \cdot {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \]
    5. exp-neg20.2%

      \[\leadsto d \cdot {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \]
    6. exp-prod20.5%

      \[\leadsto d \cdot \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \]
    7. distribute-lft-neg-out20.5%

      \[\leadsto d \cdot e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \]
    8. distribute-rgt-neg-in20.5%

      \[\leadsto d \cdot e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \]
    9. metadata-eval20.5%

      \[\leadsto d \cdot e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \]
    10. exp-to-pow21.3%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  10. Simplified21.3%

    \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2024152 
(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)))))