Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.2% → 72.6%
Time: 20.2s
Alternatives: 17
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 66.2% accurate, 1.0× speedup?

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

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

Alternative 1: 72.6% accurate, 1.4× speedup?

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

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

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

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

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


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

    1. Initial program 56.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. Step-by-step derivation
      1. associate-*l*56.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.70000000000000003e230 < l < -1.999999999999994e-310

    1. Initial program 63.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. Applied egg-rr24.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l < 4.49999999999999982e149

    1. Initial program 69.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. Applied egg-rr25.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.49999999999999982e149 < l

    1. Initial program 47.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. Taylor expanded in d around inf 57.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity57.2%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 74.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 56.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. Step-by-step derivation
      1. associate-*l*56.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.60000000000000012e232 < l < -1.999999999999994e-310

    1. Initial program 63.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. Applied egg-rr24.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 62.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. Applied egg-rr25.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 55.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\ell \cdot h}\\ \mathbf{if}\;\ell \leq -4.2 \cdot 10^{-140}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-301}:\\ \;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\ \mathbf{elif}\;\ell \leq 2.5 \cdot 10^{+149}:\\ \;\;\;\;\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* l h))))
   (if (<= l -4.2e-140)
     (* (sqrt (/ d h)) (sqrt (/ d l)))
     (if (<= l 1.4e-301)
       (* d (sqrt (cbrt (* t_0 (* t_0 t_0)))))
       (if (<= l 2.5e+149)
         (*
          (+ 1.0 (* -0.5 (* (/ h l) (pow (* D (/ (/ M d) 2.0)) 2.0))))
          (* d (pow (* l h) -0.5)))
         (* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 / (l * h);
	double tmp;
	if (l <= -4.2e-140) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (l <= 1.4e-301) {
		tmp = d * sqrt(cbrt((t_0 * (t_0 * t_0))));
	} else if (l <= 2.5e+149) {
		tmp = (1.0 + (-0.5 * ((h / l) * pow((D * ((M / d) / 2.0)), 2.0)))) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 / (l * h);
	double tmp;
	if (l <= -4.2e-140) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (l <= 1.4e-301) {
		tmp = d * Math.sqrt(Math.cbrt((t_0 * (t_0 * t_0))));
	} else if (l <= 2.5e+149) {
		tmp = (1.0 + (-0.5 * ((h / l) * Math.pow((D * ((M / d) / 2.0)), 2.0)))) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = Float64(1.0 / Float64(l * h))
	tmp = 0.0
	if (l <= -4.2e-140)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (l <= 1.4e-301)
		tmp = Float64(d * sqrt(cbrt(Float64(t_0 * Float64(t_0 * t_0)))));
	elseif (l <= 2.5e+149)
		tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0)))) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h)));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.2e-140], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.4e-301], N[(d * N[Sqrt[N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.5e+149], N[(N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{-140}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-301}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\

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

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


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

    1. Initial program 61.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. Step-by-step derivation
      1. associate-*l*61.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.20000000000000035e-140 < l < 1.4000000000000001e-301

    1. Initial program 68.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. Taylor expanded in d around inf 26.2%

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

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

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

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

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

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

    if 1.4000000000000001e-301 < l < 2.49999999999999995e149

    1. Initial program 69.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.49999999999999995e149 < l

    1. Initial program 47.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. Taylor expanded in d around inf 57.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity57.2%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 58.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\ell \cdot h}\\ \mathbf{if}\;\ell \leq -4.1 \cdot 10^{-140}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\ \mathbf{elif}\;\ell \leq 2.5 \cdot 10^{+150}:\\ \;\;\;\;\left(1 + -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* l h))))
   (if (<= l -4.1e-140)
     (* (sqrt (/ d h)) (sqrt (/ d l)))
     (if (<= l -2e-310)
       (* d (sqrt (cbrt (* t_0 (* t_0 t_0)))))
       (if (<= l 2.5e+150)
         (*
          (+ 1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l)))
          (* d (pow (* l h) -0.5)))
         (* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 / (l * h);
	double tmp;
	if (l <= -4.1e-140) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (l <= -2e-310) {
		tmp = d * sqrt(cbrt((t_0 * (t_0 * t_0))));
	} else if (l <= 2.5e+150) {
		tmp = (1.0 + (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l))) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 / (l * h);
	double tmp;
	if (l <= -4.1e-140) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (l <= -2e-310) {
		tmp = d * Math.sqrt(Math.cbrt((t_0 * (t_0 * t_0))));
	} else if (l <= 2.5e+150) {
		tmp = (1.0 + (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l))) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = Float64(1.0 / Float64(l * h))
	tmp = 0.0
	if (l <= -4.1e-140)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (l <= -2e-310)
		tmp = Float64(d * sqrt(cbrt(Float64(t_0 * Float64(t_0 * t_0)))));
	elseif (l <= 2.5e+150)
		tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l))) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h)));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.1e-140], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Sqrt[N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.5e+150], N[(N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -4.1 \cdot 10^{-140}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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

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

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


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

    1. Initial program 61.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. Step-by-step derivation
      1. associate-*l*61.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1000000000000001e-140 < l < -1.999999999999994e-310

    1. Initial program 68.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. Taylor expanded in d around inf 20.6%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. add-cbrt-cube42.6%

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

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

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

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

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

    if -1.999999999999994e-310 < l < 2.50000000000000004e150

    1. Initial program 69.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. Applied egg-rr25.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.50000000000000004e150 < l

    1. Initial program 47.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. Taylor expanded in d around inf 57.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity57.2%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 65.2% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 63.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. Applied egg-rr24.7%

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

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

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

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

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

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

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

    if -1.15e-299 < l < 2.65000000000000007e150

    1. Initial program 68.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. Applied egg-rr25.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.65000000000000007e150 < l

    1. Initial program 47.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. Taylor expanded in d around inf 57.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity57.2%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 73.3% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 62.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. Applied egg-rr24.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l < 8.00000000000000039e149

    1. Initial program 69.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. Applied egg-rr25.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.00000000000000039e149 < l

    1. Initial program 47.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. Taylor expanded in d around inf 57.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity57.2%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 45.4% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq 7.6 \cdot 10^{-255}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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

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


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

    1. Initial program 59.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.6e-255 < d < 7.49999999999999995e-149

    1. Initial program 50.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. Taylor expanded in d around 0 54.8%

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

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

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

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

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

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

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

    if 7.49999999999999995e-149 < d

    1. Initial program 69.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf 58.8%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity58.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 7.6 \cdot 10^{-255}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{-149}:\\ \;\;\;\;-0.125 \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 8: 46.2% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.35 \cdot 10^{-267}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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

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


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

    1. Initial program 60.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.34999999999999994e-267 < d < 1.2199999999999999e-149

    1. Initial program 46.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. Taylor expanded in d around 0 50.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}}} \]
    5. Taylor expanded in d around 0 50.2%

      \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\color{blue}{\frac{d}{{D}^{2} \cdot {M}^{2}}}} \]
    6. Step-by-step derivation
      1. unpow250.2%

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

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

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

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

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

    if 1.2199999999999999e-149 < d

    1. Initial program 69.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf 58.8%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity58.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.35 \cdot 10^{-267}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 1.22 \cdot 10^{-149}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{d}{D \cdot \left(M \cdot \left(D \cdot M\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 9: 46.5% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.15 \cdot 10^{-306}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;d \leq 1.85 \cdot 10^{-152}:\\
\;\;\;\;\frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\

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


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

    1. Initial program 62.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. Step-by-step derivation
      1. associate-*l*62.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.14999999999999995e-306 < d < 1.8499999999999999e-152

    1. Initial program 42.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. Taylor expanded in d around 0 47.6%

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

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

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

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

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

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

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

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

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

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

    if 1.8499999999999999e-152 < d

    1. Initial program 69.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf 58.8%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity58.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.15 \cdot 10^{-306}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 1.85 \cdot 10^{-152}:\\ \;\;\;\;\frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 10: 47.8% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.15 \cdot 10^{-306}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;d \leq 3.7 \cdot 10^{-148}:\\
\;\;\;\;\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}}\\

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


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

    1. Initial program 62.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. Step-by-step derivation
      1. associate-*l*62.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.14999999999999995e-306 < d < 3.70000000000000034e-148

    1. Initial program 42.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. Taylor expanded in d around 0 47.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}}} \]
    5. Step-by-step derivation
      1. sqrt-div62.9%

        \[\leadsto \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}} \cdot \frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}} \]
    6. Applied egg-rr62.9%

      \[\leadsto \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}} \cdot \frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}} \]
    7. Step-by-step derivation
      1. sqr-pow62.9%

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

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

        \[\leadsto \frac{\sqrt{h}}{\left|{\ell}^{\color{blue}{1.5}}\right|} \cdot \frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}} \]
      4. sqr-pow71.8%

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

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

        \[\leadsto \frac{\sqrt{h}}{\color{blue}{{\ell}^{1.5}}} \cdot \frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}} \]
    8. Simplified71.8%

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

    if 3.70000000000000034e-148 < d

    1. Initial program 69.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf 58.8%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity58.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.15 \cdot 10^{-306}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 3.7 \cdot 10^{-148}:\\ \;\;\;\;\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{-0.125}{\frac{\frac{\frac{d}{M}}{M}}{D \cdot D}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 11: 29.9% accurate, 1.6× speedup?

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

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

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


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

    1. Initial program 58.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf 12.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity12.0%

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

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

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

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

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

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

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow12.0%

        \[\leadsto \left|\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}}\right| \cdot d \]
      7. fabs-sqr12.0%

        \[\leadsto \color{blue}{\left({\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \cdot d \]
      8. sqr-pow12.0%

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

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

    if 1.8500000000000001e-208 < d

    1. Initial program 67.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf 54.8%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity54.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.85 \cdot 10^{-208}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \end{array} \]

Alternative 12: 29.7% accurate, 1.6× speedup?

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

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

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


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

    1. Initial program 57.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. Taylor expanded in d around inf 13.6%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity13.6%

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow13.6%

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

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

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

        \[\leadsto \left|\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}}\right| \cdot d \]
      7. fabs-sqr13.6%

        \[\leadsto \color{blue}{\left({\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \cdot d \]
      8. sqr-pow13.6%

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

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

    if 3.14999999999999975e-147 < d

    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. Taylor expanded in d around inf 58.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity58.4%

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

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

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

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

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

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

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

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

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

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

Alternative 13: 44.3% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq 5.6 \cdot 10^{-308}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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


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

    1. Initial program 62.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. Step-by-step derivation
      1. associate-*l*62.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.59999999999999969e-308 < d

    1. Initial program 62.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. Taylor expanded in d around inf 50.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity50.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 5.6 \cdot 10^{-308}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 14: 26.1% accurate, 3.0× speedup?

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

\\
d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}
\end{array}
Derivation
  1. Initial program 62.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. Taylor expanded in d around inf 30.6%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  3. Step-by-step derivation
    1. *-un-lft-identity30.6%

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot d \]
  6. Simplified30.9%

    \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot d \]
  7. Step-by-step derivation
    1. div-inv30.9%

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

    \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell} \cdot \frac{1}{h}}} \cdot d \]
  9. Final simplification30.9%

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

Alternative 15: 26.0% accurate, 3.1× speedup?

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

\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 62.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. Taylor expanded in d around inf 30.6%

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

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

Alternative 16: 26.2% accurate, 3.1× speedup?

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

\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Derivation
  1. Initial program 62.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. Taylor expanded in d around inf 30.6%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  3. Step-by-step derivation
    1. *-un-lft-identity30.6%

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot d \]
  6. Simplified30.9%

    \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot d \]
  7. Final simplification30.9%

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

Alternative 17: 25.9% accurate, 3.1× speedup?

\[\begin{array}{l} \\ d \cdot {\left(\ell \cdot h\right)}^{-0.5} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (pow (* l h) -0.5)))
double code(double d, double h, double l, double M, double D) {
	return d * pow((l * h), -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 * ((l * h) ** (-0.5d0))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.pow((l * h), -0.5);
}
def code(d, h, l, M, D):
	return d * math.pow((l * h), -0.5)
function code(d, h, l, M, D)
	return Float64(d * (Float64(l * h) ^ -0.5))
end
function tmp = code(d, h, l, M, D)
	tmp = d * ((l * h) ^ -0.5);
end
code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 62.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. Taylor expanded in d around inf 30.6%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  3. Step-by-step derivation
    1. *-un-lft-identity30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

?
herbie shell --seed 2023222 
(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)))))