Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.0% → 75.8%
Time: 24.5s
Alternatives: 19
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 66.0% 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: 75.8% accurate, 0.8× speedup?

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

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

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


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

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

        \[\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-eval65.3%

        \[\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/265.3%

        \[\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-eval65.3%

        \[\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/265.3%

        \[\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*65.3%

        \[\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-eval65.3%

        \[\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-frac65.4%

        \[\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. Simplified65.4%

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

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

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

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

    if -1.000000000000002e-309 < h

    1. Initial program 67.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*67.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-eval67.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/267.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-eval67.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/267.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. associate-*l*67.2%

        \[\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-eval67.2%

        \[\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-frac67.2%

        \[\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. Simplified67.2%

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

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

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

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

Alternative 2: 70.6% accurate, 0.8× speedup?

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

\mathbf{elif}\;\ell \leq 6 \cdot 10^{+165}:\\
\;\;\;\;\frac{t_0}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \left({\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{0.5}{\ell}\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 l < -4.4000000000000001e25

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

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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*59.5%

        \[\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-eval59.5%

        \[\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-frac59.6%

        \[\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. Simplified59.6%

      \[\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. frac-2neg59.6%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    5. Applied egg-rr65.2%

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

    if -4.4000000000000001e25 < l < 5.99999999999999981e165

    1. Initial program 73.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.99999999999999981e165 < l

    1. Initial program 42.6%

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

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

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

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

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

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

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

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

Alternative 3: 67.1% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 2.4e165

    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. Step-by-step derivation
      1. associate-*l*69.3%

        \[\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-eval69.3%

        \[\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/269.3%

        \[\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-eval69.3%

        \[\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/269.3%

        \[\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*69.3%

        \[\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-eval69.3%

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

    if 2.4e165 < l

    1. Initial program 42.6%

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

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

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

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

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

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

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

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

Alternative 4: 67.2% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 2.9999999999999999e165

    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. Step-by-step derivation
      1. metadata-eval69.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.9999999999999999e165 < l

    1. Initial program 42.6%

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

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

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

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

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

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

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

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

Alternative 5: 69.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.1 \cdot 10^{+159}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\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.1e+159)
   (*
    (- 1.0 (/ (* h (* 0.5 (pow (* (/ D d) (* 0.5 M)) 2.0))) l))
    (* (sqrt (/ d l)) (sqrt (/ d h))))
   (* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= 1.1e+159) {
		tmp = (1.0 - ((h * (0.5 * pow(((D / d) * (0.5 * M)), 2.0))) / l)) * (sqrt((d / l)) * sqrt((d / h)));
	} 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.1d+159) then
        tmp = (1.0d0 - ((h * (0.5d0 * (((d_1 / d) * (0.5d0 * m)) ** 2.0d0))) / l)) * (sqrt((d / l)) * sqrt((d / h)))
    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.1e+159) {
		tmp = (1.0 - ((h * (0.5 * Math.pow(((D / d) * (0.5 * M)), 2.0))) / l)) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
	} 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.1e+159:
		tmp = (1.0 - ((h * (0.5 * math.pow(((D / d) * (0.5 * M)), 2.0))) / l)) * (math.sqrt((d / l)) * math.sqrt((d / h)))
	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.1e+159)
		tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0))) / l)) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))));
	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.1e+159)
		tmp = (1.0 - ((h * (0.5 * (((D / d) * (0.5 * M)) ^ 2.0))) / l)) * (sqrt((d / l)) * sqrt((d / h)));
	else
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.1e+159], N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $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}\;\ell \leq 1.1 \cdot 10^{+159}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\

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


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

    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. Step-by-step derivation
      1. metadata-eval69.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1e159 < l

    1. Initial program 45.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 50.0%

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    4. Simplified50.0%

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

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

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

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

Alternative 6: 69.3% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 2.1000000000000001e165

    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. Step-by-step derivation
      1. metadata-eval69.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.1000000000000001e165 < l

    1. Initial program 42.6%

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

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

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

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

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

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

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

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

Alternative 7: 48.9% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;M \leq 7.8 \cdot 10^{-169}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 7.79999999999999954e-169

    1. Initial program 63.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*63.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-eval63.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/263.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-eval63.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/263.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-neg63.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. +-commutative63.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. *-commutative63.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-in63.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-def63.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.4%

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

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

    if 7.79999999999999954e-169 < M < 2.69999999999999999e-16

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.69999999999999999e-16 < M

    1. Initial program 69.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. expm1-log1p-u23.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 7.8 \cdot 10^{-169}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;M \leq 2.7 \cdot 10^{-16}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - 0.125 \cdot \left(\left(D \cdot \left(\left(M \cdot D\right) \cdot \frac{M}{\ell}\right)\right) \cdot \frac{h}{d \cdot d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(h \cdot \frac{0.5}{\ell}\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\\ \end{array} \]

Alternative 8: 47.7% accurate, 1.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 2.20000000000000011e-163

    1. Initial program 64.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*64.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-eval64.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/264.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-eval64.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/264.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-neg64.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. +-commutative64.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. *-commutative64.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-in64.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-def64.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.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 45.4%

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

    if 2.20000000000000011e-163 < M

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 48.4% accurate, 1.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 1.4e-165

    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. Step-by-step derivation
      1. associate-*l*63.9%

        \[\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-eval63.9%

        \[\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/263.9%

        \[\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-eval63.9%

        \[\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/263.9%

        \[\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-neg63.9%

        \[\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. +-commutative63.9%

        \[\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. *-commutative63.9%

        \[\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-in63.9%

        \[\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-def63.9%

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

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

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

    if 1.4e-165 < M

    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. Step-by-step derivation
      1. expm1-log1p-u31.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 48.3% accurate, 1.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 2.6000000000000002e-164

    1. Initial program 64.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*64.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-eval64.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/264.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-eval64.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/264.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-neg64.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. +-commutative64.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. *-commutative64.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-in64.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-def64.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.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 45.4%

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

    if 2.6000000000000002e-164 < M

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 40.6% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\
\mathbf{if}\;M \leq 7.5 \cdot 10^{-77}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{elif}\;M \leq 1.25 \cdot 10^{-46}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;M \leq 7.2 \cdot 10^{-7}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if M < 7.5000000000000006e-77

    1. Initial program 64.6%

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

        \[\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-eval64.6%

        \[\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/264.6%

        \[\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-eval64.6%

        \[\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/264.6%

        \[\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-neg64.6%

        \[\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. +-commutative64.6%

        \[\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. *-commutative64.6%

        \[\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-in64.6%

        \[\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-def64.6%

        \[\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. Simplified63.5%

      \[\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.9%

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

    if 7.5000000000000006e-77 < M < 1.24999999999999998e-46 or 4.5e15 < M

    1. Initial program 71.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. expm1-log1p-u22.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.24999999999999998e-46 < M < 7.19999999999999989e-7

    1. Initial program 46.6%

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

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

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

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

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

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

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

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

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

    if 7.19999999999999989e-7 < M < 4.5e15

    1. Initial program 69.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0 31.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*31.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 7.5 \cdot 10^{-77}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;M \leq 1.25 \cdot 10^{-46}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{elif}\;M \leq 7.2 \cdot 10^{-7}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{elif}\;M \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;-0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{D \cdot D}{\frac{d}{M \cdot M}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \end{array} \]

Alternative 12: 40.6% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\
\mathbf{if}\;M \leq 6.6 \cdot 10^{-77}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{elif}\;M \leq 1.1 \cdot 10^{-47}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;M \leq 1.5 \cdot 10^{-8}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if M < 6.59999999999999982e-77

    1. Initial program 64.6%

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

        \[\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-eval64.6%

        \[\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/264.6%

        \[\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-eval64.6%

        \[\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/264.6%

        \[\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-neg64.6%

        \[\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. +-commutative64.6%

        \[\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. *-commutative64.6%

        \[\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-in64.6%

        \[\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-def64.6%

        \[\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. Simplified63.5%

      \[\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.9%

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

    if 6.59999999999999982e-77 < M < 1.10000000000000009e-47 or 2.3e15 < M

    1. Initial program 71.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. expm1-log1p-u22.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.10000000000000009e-47 < M < 1.49999999999999987e-8

    1. Initial program 46.6%

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

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

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

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

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

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

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

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

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

    if 1.49999999999999987e-8 < M < 2.3e15

    1. Initial program 69.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0 31.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/31.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 6.6 \cdot 10^{-77}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;M \leq 1.1 \cdot 10^{-47}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{elif}\;M \leq 1.5 \cdot 10^{-8}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{elif}\;M \leq 2.3 \cdot 10^{+15}:\\ \;\;\;\;-0.125 \cdot \frac{D \cdot \left(M \cdot \left(M \cdot D\right)\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \end{array} \]

Alternative 13: 47.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{if}\;\ell \leq -1.85 \cdot 10^{-118}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;\ell \leq -2.7 \cdot 10^{-169}:\\ \;\;\;\;t_0 \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;\ell \leq -8 \cdot 10^{-206}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-286}:\\ \;\;\;\;t_0 \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\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
 (let* ((t_0 (sqrt (* (/ d l) (/ d h)))))
   (if (<= l -1.85e-118)
     (* d (- (sqrt (/ (/ 1.0 l) h))))
     (if (<= l -2.7e-169)
       (* t_0 (* -0.125 (* (/ (* D D) (* d d)) (/ (* h (* M M)) l))))
       (if (<= l -8e-206)
         (* d (- (pow (* h l) -0.5)))
         (if (<= l 8.5e-286)
           (* t_0 (* -0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h)))))
           (* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(((d / l) * (d / h)));
	double tmp;
	if (l <= -1.85e-118) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else if (l <= -2.7e-169) {
		tmp = t_0 * (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l)));
	} else if (l <= -8e-206) {
		tmp = d * -pow((h * l), -0.5);
	} else if (l <= 8.5e-286) {
		tmp = t_0 * (-0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))));
	} 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 = sqrt(((d / l) * (d / h)))
    if (l <= (-1.85d-118)) then
        tmp = d * -sqrt(((1.0d0 / l) / h))
    else if (l <= (-2.7d-169)) then
        tmp = t_0 * ((-0.125d0) * (((d_1 * d_1) / (d * d)) * ((h * (m * m)) / l)))
    else if (l <= (-8d-206)) then
        tmp = d * -((h * l) ** (-0.5d0))
    else if (l <= 8.5d-286) then
        tmp = t_0 * ((-0.125d0) * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h))))
    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 = Math.sqrt(((d / l) * (d / h)));
	double tmp;
	if (l <= -1.85e-118) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else if (l <= -2.7e-169) {
		tmp = t_0 * (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l)));
	} else if (l <= -8e-206) {
		tmp = d * -Math.pow((h * l), -0.5);
	} else if (l <= 8.5e-286) {
		tmp = t_0 * (-0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt(((d / l) * (d / h)))
	tmp = 0
	if l <= -1.85e-118:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	elif l <= -2.7e-169:
		tmp = t_0 * (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l)))
	elif l <= -8e-206:
		tmp = d * -math.pow((h * l), -0.5)
	elif l <= 8.5e-286:
		tmp = t_0 * (-0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))))
	else:
		tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h))
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h)))
	tmp = 0.0
	if (l <= -1.85e-118)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	elseif (l <= -2.7e-169)
		tmp = Float64(t_0 * Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(Float64(h * Float64(M * M)) / l))));
	elseif (l <= -8e-206)
		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
	elseif (l <= 8.5e-286)
		tmp = Float64(t_0 * Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))));
	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 = sqrt(((d / l) * (d / h)));
	tmp = 0.0;
	if (l <= -1.85e-118)
		tmp = d * -sqrt(((1.0 / l) / h));
	elseif (l <= -2.7e-169)
		tmp = t_0 * (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l)));
	elseif (l <= -8e-206)
		tmp = d * -((h * l) ^ -0.5);
	elseif (l <= 8.5e-286)
		tmp = t_0 * (-0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))));
	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[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.85e-118], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2.7e-169], N[(t$95$0 * N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -8e-206], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 8.5e-286], N[(t$95$0 * N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $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}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{if}\;\ell \leq -1.85 \cdot 10^{-118}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{elif}\;\ell \leq -2.7 \cdot 10^{-169}:\\
\;\;\;\;t_0 \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\

\mathbf{elif}\;\ell \leq -8 \cdot 10^{-206}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\

\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-286}:\\
\;\;\;\;t_0 \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if l < -1.85000000000000007e-118

    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. Step-by-step derivation
      1. metadata-eval63.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    11. Step-by-step derivation
      1. mul-1-neg49.4%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. distribute-rgt-neg-in49.4%

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

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

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

    if -1.85000000000000007e-118 < l < -2.7000000000000002e-169

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.7000000000000002e-169 < l < -8.00000000000000023e-206

    1. Initial program 87.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. Step-by-step derivation
      1. metadata-eval87.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    15. Step-by-step derivation
      1. mul-1-neg75.7%

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

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

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

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

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

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

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

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

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

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

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

    if -8.00000000000000023e-206 < l < 8.4999999999999998e-286

    1. Initial program 66.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. Step-by-step derivation
      1. expm1-log1p-u4.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.4999999999999998e-286 < l

    1. Initial program 66.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 41.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.85 \cdot 10^{-118}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;\ell \leq -2.7 \cdot 10^{-169}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;\ell \leq -8 \cdot 10^{-206}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-286}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 14: 40.6% accurate, 1.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 6.59999999999999982e-77

    1. Initial program 64.6%

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

        \[\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-eval64.6%

        \[\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/264.6%

        \[\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-eval64.6%

        \[\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/264.6%

        \[\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-neg64.6%

        \[\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. +-commutative64.6%

        \[\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. *-commutative64.6%

        \[\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-in64.6%

        \[\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-def64.6%

        \[\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. Simplified63.5%

      \[\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.9%

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

    if 6.59999999999999982e-77 < M

    1. Initial program 69.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. expm1-log1p-u25.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 6.6 \cdot 10^{-77}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \end{array} \]

Alternative 15: 35.0% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{if}\;M \leq 1.1 \cdot 10^{-213}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;M \leq 5.4 \cdot 10^{-197}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\

\mathbf{elif}\;M \leq 2.45 \cdot 10^{-77}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 1.10000000000000005e-213 or 5.40000000000000034e-197 < M < 2.4499999999999999e-77

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.10000000000000005e-213 < M < 5.40000000000000034e-197

    1. Initial program 53.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 69.5%

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    4. Simplified69.5%

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

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

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

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

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

    if 2.4499999999999999e-77 < M

    1. Initial program 69.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. expm1-log1p-u25.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 1.1 \cdot 10^{-213}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;M \leq 5.4 \cdot 10^{-197}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{elif}\;M \leq 2.45 \cdot 10^{-77}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \end{array} \]

Alternative 16: 42.6% accurate, 3.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -1.18e-216

    1. Initial program 65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    11. Step-by-step derivation
      1. mul-1-neg47.0%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. distribute-rgt-neg-in47.0%

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

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

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

    if -1.18e-216 < l

    1. Initial program 66.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 38.7%

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

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

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

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

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

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

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

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

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

Alternative 17: 42.5% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;d \leq 5.8 \cdot 10^{-204}:\\
\;\;\;\;d \cdot \left(-t_0\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot t_0\\


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

    1. Initial program 62.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. Step-by-step derivation
      1. metadata-eval62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    15. Step-by-step derivation
      1. mul-1-neg38.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. distribute-rgt-neg-in38.3%

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

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

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

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

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

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

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

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

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

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

    if 5.80000000000000018e-204 < d

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. expm1-log1p-u47.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 42.6% accurate, 3.0× speedup?

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

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

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


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

    1. Initial program 62.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. Step-by-step derivation
      1. metadata-eval62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{d \cdot 2} \cdot D\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. *-commutative61.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{\color{blue}{2 \cdot d}} \cdot D\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    7. Simplified61.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2 \cdot d} \cdot D\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    8. Step-by-step derivation
      1. clear-num61.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{1}{\frac{\ell}{d}}}}\right) \cdot \left(1 - {\left(\frac{M}{2 \cdot d} \cdot D\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. sqrt-div60.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{d}}}}\right) \cdot \left(1 - {\left(\frac{M}{2 \cdot d} \cdot D\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. metadata-eval60.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{d}}}\right) \cdot \left(1 - {\left(\frac{M}{2 \cdot d} \cdot D\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    9. Applied egg-rr60.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{1}{\sqrt{\frac{\ell}{d}}}}\right) \cdot \left(1 - {\left(\frac{M}{2 \cdot d} \cdot D\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    10. Step-by-step derivation
      1. pow160.9%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{d}{h}} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right) \cdot \left(1 - {\left(\frac{M}{2 \cdot d} \cdot D\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)}^{1}} \]
      2. un-div-inv60.9%

        \[\leadsto {\left(\color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}}} \cdot \left(1 - {\left(\frac{M}{2 \cdot d} \cdot D\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)}^{1} \]
      3. *-commutative60.9%

        \[\leadsto {\left(\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - {\left(\frac{M}{\color{blue}{d \cdot 2}} \cdot D\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)}^{1} \]
      4. associate-*r/60.9%

        \[\leadsto {\left(\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - {\left(\frac{M}{d \cdot 2} \cdot D\right)}^{2} \cdot \color{blue}{\frac{0.5 \cdot h}{\ell}}\right)\right)}^{1} \]
    11. Applied egg-rr60.9%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - {\left(\frac{M}{d \cdot 2} \cdot D\right)}^{2} \cdot \frac{0.5 \cdot h}{\ell}\right)\right)}^{1}} \]
    12. Step-by-step derivation
      1. unpow160.9%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - {\left(\frac{M}{d \cdot 2} \cdot D\right)}^{2} \cdot \frac{0.5 \cdot h}{\ell}\right)} \]
      2. associate-/l*61.0%

        \[\leadsto \frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - {\left(\frac{M}{d \cdot 2} \cdot D\right)}^{2} \cdot \color{blue}{\frac{0.5}{\frac{\ell}{h}}}\right) \]
      3. *-commutative61.0%

        \[\leadsto \frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - {\color{blue}{\left(D \cdot \frac{M}{d \cdot 2}\right)}}^{2} \cdot \frac{0.5}{\frac{\ell}{h}}\right) \]
      4. *-commutative61.0%

        \[\leadsto \frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - {\left(D \cdot \frac{M}{\color{blue}{2 \cdot d}}\right)}^{2} \cdot \frac{0.5}{\frac{\ell}{h}}\right) \]
    13. Simplified61.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot \frac{0.5}{\frac{\ell}{h}}\right)} \]
    14. Taylor expanded in d around -inf 38.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    15. Step-by-step derivation
      1. mul-1-neg38.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. distribute-rgt-neg-in38.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      3. unpow-138.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{-1}}}\right) \]
      4. sqr-pow38.3%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)}}}\right) \]
      5. rem-sqrt-square38.3%

        \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)}\right|}\right) \]
      6. sqr-pow38.2%

        \[\leadsto d \cdot \left(-\left|\color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{\frac{-1}{2}}{2}\right)} \cdot {\left(\ell \cdot h\right)}^{\left(\frac{\frac{-1}{2}}{2}\right)}}\right|\right) \]
      7. fabs-sqr38.2%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{\frac{-1}{2}}{2}\right)} \cdot {\left(\ell \cdot h\right)}^{\left(\frac{\frac{-1}{2}}{2}\right)}}\right) \]
      8. sqr-pow38.3%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)}}\right) \]
      9. *-commutative38.3%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(h \cdot \ell\right)}}^{\left(\frac{-1}{2}\right)}\right) \]
      10. metadata-eval38.3%

        \[\leadsto d \cdot \left(-{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    16. Simplified38.3%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

    if 1.1600000000000001e-200 < d

    1. Initial program 71.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 48.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative48.0%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/r*48.0%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    4. Simplified48.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    5. Taylor expanded in d around 0 48.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative48.0%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/48.0%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    7. Simplified48.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.16 \cdot 10^{-200}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \]

Alternative 19: 27.2% accurate, 3.1× speedup?

\[\begin{array}{l} \\ d \cdot {\left(h \cdot \ell\right)}^{-0.5} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (pow (* h l) -0.5)))
double code(double d, double h, double l, double M, double D) {
	return d * pow((h * l), -0.5);
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d * ((h * l) ** (-0.5d0))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.pow((h * l), -0.5);
}
def code(d, h, l, M, D):
	return d * math.pow((h * l), -0.5)
function code(d, h, l, M, D)
	return Float64(d * (Float64(h * l) ^ -0.5))
end
function tmp = code(d, h, l, M, D)
	tmp = d * ((h * l) ^ -0.5);
end
code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 66.2%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Taylor expanded in d around inf 24.9%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  3. Step-by-step derivation
    1. expm1-log1p-u24.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \cdot d \]
    2. expm1-udef16.3%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{1}{\ell \cdot h}}\right)} - 1\right)} \cdot d \]
  4. Applied egg-rr16.3%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{1}{\ell \cdot h}}\right)} - 1\right)} \cdot d \]
  5. Step-by-step derivation
    1. expm1-def24.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \cdot d \]
    2. expm1-log1p24.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}}} \cdot d \]
    3. unpow-124.9%

      \[\leadsto \sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{-1}}} \cdot d \]
    4. sqr-pow24.9%

      \[\leadsto \sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)}}} \cdot d \]
    5. rem-sqrt-square24.2%

      \[\leadsto \color{blue}{\left|{\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
    6. sqr-pow24.1%

      \[\leadsto \left|\color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{\frac{-1}{2}}{2}\right)} \cdot {\left(\ell \cdot h\right)}^{\left(\frac{\frac{-1}{2}}{2}\right)}}\right| \cdot d \]
    7. fabs-sqr24.1%

      \[\leadsto \color{blue}{\left({\left(\ell \cdot h\right)}^{\left(\frac{\frac{-1}{2}}{2}\right)} \cdot {\left(\ell \cdot h\right)}^{\left(\frac{\frac{-1}{2}}{2}\right)}\right)} \cdot d \]
    8. sqr-pow24.2%

      \[\leadsto \color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)}} \cdot d \]
    9. *-commutative24.2%

      \[\leadsto {\color{blue}{\left(h \cdot \ell\right)}}^{\left(\frac{-1}{2}\right)} \cdot d \]
    10. metadata-eval24.2%

      \[\leadsto {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}} \cdot d \]
  6. Simplified24.2%

    \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
  7. Final simplification24.2%

    \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{-0.5} \]

Reproduce

?
herbie shell --seed 2023230 
(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)))))