Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.2% → 86.1%
Time: 29.5s
Alternatives: 18
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 18 alternatives:

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

Initial Program: 67.2% accurate, 1.0× speedup?

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

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

Alternative 1: 86.1% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < d

    1. Initial program 67.2%

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

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

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

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

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

Alternative 2: 69.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{D}^{2} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{-8 \cdot \frac{d}{{M}^{2}}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<=
      (*
       (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
       (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M) (* d 2.0)) 2.0)))))
      INFINITY)
   (*
    (- 1.0 (* 0.5 (* 0.25 (* (/ h l) (pow (* D (/ M d)) 2.0)))))
    (* (sqrt (/ d l)) (sqrt (/ d h))))
   (/ (* (pow D 2.0) (/ (sqrt h) (pow l 1.5))) (* -8.0 (/ d (pow M 2.0))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M) / (d * 2.0)), 2.0))))) <= ((double) INFINITY)) {
		tmp = (1.0 - (0.5 * (0.25 * ((h / l) * pow((D * (M / d)), 2.0))))) * (sqrt((d / l)) * sqrt((d / h)));
	} else {
		tmp = (pow(D, 2.0) * (sqrt(h) / pow(l, 1.5))) / (-8.0 * (d / pow(M, 2.0)));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (((Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D * M) / (d * 2.0)), 2.0))))) <= Double.POSITIVE_INFINITY) {
		tmp = (1.0 - (0.5 * (0.25 * ((h / l) * Math.pow((D * (M / d)), 2.0))))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
	} else {
		tmp = (Math.pow(D, 2.0) * (Math.sqrt(h) / Math.pow(l, 1.5))) / (-8.0 * (d / Math.pow(M, 2.0)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if ((math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D * M) / (d * 2.0)), 2.0))))) <= math.inf:
		tmp = (1.0 - (0.5 * (0.25 * ((h / l) * math.pow((D * (M / d)), 2.0))))) * (math.sqrt((d / l)) * math.sqrt((d / h)))
	else:
		tmp = (math.pow(D, 2.0) * (math.sqrt(h) / math.pow(l, 1.5))) / (-8.0 * (d / math.pow(M, 2.0)))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0))))) <= Inf)
		tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(Float64(h / l) * (Float64(D * Float64(M / d)) ^ 2.0))))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))));
	else
		tmp = Float64(Float64((D ^ 2.0) * Float64(sqrt(h) / (l ^ 1.5))) / Float64(-8.0 * Float64(d / (M ^ 2.0))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (((((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D * M) / (d * 2.0)) ^ 2.0))))) <= Inf)
		tmp = (1.0 - (0.5 * (0.25 * ((h / l) * ((D * (M / d)) ^ 2.0))))) * (sqrt((d / l)) * sqrt((d / h)));
	else
		tmp = ((D ^ 2.0) * (sqrt(h) / (l ^ 1.5))) / (-8.0 * (d / (M ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(1.0 - N[(0.5 * N[(0.25 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[D, 2.0], $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-8.0 * N[(d / N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{{D}^{2} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{-8 \cdot \frac{d}{{M}^{2}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0

    1. Initial program 88.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. Simplified88.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l))))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{D}^{2} \cdot \frac{\sqrt{h}}{{\ell}^{\color{blue}{1.5}}}}{\frac{d}{-0.125 \cdot {M}^{2}}} \]
      7. *-un-lft-identity19.1%

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

        \[\leadsto \frac{{D}^{2} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{\color{blue}{\frac{1}{-0.125} \cdot \frac{d}{{M}^{2}}}} \]
      9. metadata-eval19.1%

        \[\leadsto \frac{{D}^{2} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{\color{blue}{-8} \cdot \frac{d}{{M}^{2}}} \]
    10. Applied egg-rr19.1%

      \[\leadsto \color{blue}{\frac{{D}^{2} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{-8 \cdot \frac{d}{{M}^{2}}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.2%

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

Alternative 3: 81.7% accurate, 0.8× speedup?

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

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

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

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


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

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

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

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

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

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

    if -1.74999999999999997e-23 < h < -1.000000000000002e-309

    1. Initial program 78.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. Simplified79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}\right)}{\ell}}\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. Simplified66.5%

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

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

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

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

Alternative 4: 82.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \left(0.25 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -1e-309)
   (*
    (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
    (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D d)) 2.0)))))
   (*
    d
    (/
     (fma h (* (* 0.25 (pow (* D (/ M d)) 2.0)) (/ -0.5 l)) 1.0)
     (* (sqrt h) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1e-309) {
		tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D / d)), 2.0))));
	} else {
		tmp = d * (fma(h, ((0.25 * pow((D * (M / d)), 2.0)) * (-0.5 / l)), 1.0) / (sqrt(h) * sqrt(l)));
	}
	return tmp;
}
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -1e-309)
		tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0)))));
	else
		tmp = Float64(d * Float64(fma(h, Float64(Float64(0.25 * (Float64(D * Float64(M / d)) ^ 2.0)) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(h) * sqrt(l))));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1e-309], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[(0.25 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 72.4%

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

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

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

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

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

    if -1.000000000000002e-309 < l

    1. Initial program 67.2%

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

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

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

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

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

Alternative 5: 79.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -3.6 \cdot 10^{-240}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\left(0.125 \cdot \left({D}^{2} \cdot \frac{{M}^{2}}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \left(0.25 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -3.6e-240)
   (*
    (sqrt (/ d l))
    (*
     (sqrt (/ d h))
     (+ 1.0 (* h (/ (* -0.5 (pow (/ D (/ (* d 2.0) M)) 2.0)) l)))))
   (if (<= d -1e-309)
     (* (* 0.125 (* (pow D 2.0) (/ (pow M 2.0) d))) (sqrt (/ h (pow l 3.0))))
     (*
      d
      (/
       (fma h (* (* 0.25 (pow (* D (/ M d)) 2.0)) (/ -0.5 l)) 1.0)
       (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -3.6e-240) {
		tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * ((-0.5 * pow((D / ((d * 2.0) / M)), 2.0)) / l))));
	} else if (d <= -1e-309) {
		tmp = (0.125 * (pow(D, 2.0) * (pow(M, 2.0) / d))) * sqrt((h / pow(l, 3.0)));
	} else {
		tmp = d * (fma(h, ((0.25 * pow((D * (M / d)), 2.0)) * (-0.5 / l)), 1.0) / (sqrt(h) * sqrt(l)));
	}
	return tmp;
}
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -3.6e-240)
		tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D / Float64(Float64(d * 2.0) / M)) ^ 2.0)) / l)))));
	elseif (d <= -1e-309)
		tmp = Float64(Float64(0.125 * Float64((D ^ 2.0) * Float64((M ^ 2.0) / d))) * sqrt(Float64(h / (l ^ 3.0))));
	else
		tmp = Float64(d * Float64(fma(h, Float64(Float64(0.25 * (Float64(D * Float64(M / d)) ^ 2.0)) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(h) * sqrt(l))));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.6e-240], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(0.125 * N[(N[Power[D, 2.0], $MachinePrecision] * N[(N[Power[M, 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[(0.25 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 80.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. Simplified82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5999999999999999e-240 < d < -1.000000000000002e-309

    1. Initial program 35.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. Simplified34.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < d

    1. Initial program 67.2%

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

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

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

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

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

Alternative 6: 82.5% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \left(-0.125 \cdot \left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{\color{blue}{d \cdot d}}\right)\right) \cdot \frac{h}{\ell}\right)\right) \]
      10. times-frac59.0%

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < l

    1. Initial program 67.2%

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

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

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

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

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

Alternative 7: 43.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;M \leq 1.85 \cdot 10^{-94} \lor \neg \left(M \leq 2.55 \cdot 10^{-67}\right) \land M \leq 1.45 \cdot 10^{-19}:\\ \;\;\;\;t\_0 \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(t\_0 \cdot \left(\frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell} \cdot \left(h \cdot -0.125\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
   (if (or (<= M 1.85e-94) (and (not (<= M 2.55e-67)) (<= M 1.45e-19)))
     (* t_0 t_1)
     (* t_1 (* t_0 (* (/ (pow (* D (/ M d)) 2.0) l) (* h -0.125)))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = sqrt((d / h));
	double tmp;
	if ((M <= 1.85e-94) || (!(M <= 2.55e-67) && (M <= 1.45e-19))) {
		tmp = t_0 * t_1;
	} else {
		tmp = t_1 * (t_0 * ((pow((D * (M / d)), 2.0) / l) * (h * -0.125)));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((d / l))
    t_1 = sqrt((d / h))
    if ((m <= 1.85d-94) .or. (.not. (m <= 2.55d-67)) .and. (m <= 1.45d-19)) then
        tmp = t_0 * t_1
    else
        tmp = t_1 * (t_0 * ((((d_1 * (m / d)) ** 2.0d0) / l) * (h * (-0.125d0))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = Math.sqrt((d / h));
	double tmp;
	if ((M <= 1.85e-94) || (!(M <= 2.55e-67) && (M <= 1.45e-19))) {
		tmp = t_0 * t_1;
	} else {
		tmp = t_1 * (t_0 * ((Math.pow((D * (M / d)), 2.0) / l) * (h * -0.125)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = math.sqrt((d / h))
	tmp = 0
	if (M <= 1.85e-94) or (not (M <= 2.55e-67) and (M <= 1.45e-19)):
		tmp = t_0 * t_1
	else:
		tmp = t_1 * (t_0 * ((math.pow((D * (M / d)), 2.0) / l) * (h * -0.125)))
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = sqrt(Float64(d / h))
	tmp = 0.0
	if ((M <= 1.85e-94) || (!(M <= 2.55e-67) && (M <= 1.45e-19)))
		tmp = Float64(t_0 * t_1);
	else
		tmp = Float64(t_1 * Float64(t_0 * Float64(Float64((Float64(D * Float64(M / d)) ^ 2.0) / l) * Float64(h * -0.125))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / l));
	t_1 = sqrt((d / h));
	tmp = 0.0;
	if ((M <= 1.85e-94) || (~((M <= 2.55e-67)) && (M <= 1.45e-19)))
		tmp = t_0 * t_1;
	else
		tmp = t_1 * (t_0 * ((((D * (M / d)) ^ 2.0) / l) * (h * -0.125)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[M, 1.85e-94], And[N[Not[LessEqual[M, 2.55e-67]], $MachinePrecision], LessEqual[M, 1.45e-19]]], N[(t$95$0 * t$95$1), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;M \leq 1.85 \cdot 10^{-94} \lor \neg \left(M \leq 2.55 \cdot 10^{-67}\right) \land M \leq 1.45 \cdot 10^{-19}:\\
\;\;\;\;t\_0 \cdot t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 1.8499999999999999e-94 or 2.54999999999999991e-67 < M < 1.45e-19

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8499999999999999e-94 < M < 2.54999999999999991e-67 or 1.45e-19 < M

    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. Simplified69.6%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 1.85 \cdot 10^{-94} \lor \neg \left(M \leq 2.55 \cdot 10^{-67}\right) \land M \leq 1.45 \cdot 10^{-19}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell} \cdot \left(h \cdot -0.125\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 68.6% accurate, 1.0× speedup?

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

\\
\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 68.2% accurate, 1.0× speedup?

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

\\
\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right)}{\ell}\right)\right)
\end{array}
Derivation
  1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 47.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -2.7 \cdot 10^{-8}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\ \;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{-0.5}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -2.7e-8)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (if (<= d -1e-309)
     (* d (log1p (expm1 (pow (* l h) -0.5))))
     (* d (/ (pow h -0.5) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -2.7e-8) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (d <= -1e-309) {
		tmp = d * log1p(expm1(pow((l * h), -0.5)));
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -2.7e-8) {
		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
	} else if (d <= -1e-309) {
		tmp = d * Math.log1p(Math.expm1(Math.pow((l * h), -0.5)));
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if d <= -2.7e-8:
		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
	elif d <= -1e-309:
		tmp = d * math.log1p(math.expm1(math.pow((l * h), -0.5)))
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -2.7e-8)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (d <= -1e-309)
		tmp = Float64(d * log1p(expm1((Float64(l * h) ^ -0.5))));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.7e-8], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(d * N[Log[1 + N[(Exp[N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{-0.5}\right)\right)\\

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


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

    1. Initial program 85.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. Simplified88.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.70000000000000002e-8 < d < -1.000000000000002e-309

    1. Initial program 58.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. Simplified58.3%

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. log1p-expm1-u39.0%

        \[\leadsto d \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
      2. pow1/239.0%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right)\right) \]
      3. inv-pow39.0%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right)\right) \]
      4. pow-pow39.0%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right)\right) \]
      5. *-commutative39.0%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\color{blue}{\left(\ell \cdot h\right)}}^{\left(-1 \cdot 0.5\right)}\right)\right) \]
      6. metadata-eval39.0%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{\color{blue}{-0.5}}\right)\right) \]
    6. Applied egg-rr39.0%

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

    if -1.000000000000002e-309 < d

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    10. Simplified47.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.7 \cdot 10^{-8}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\ \;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{-0.5}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 46.8% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{if}\;d \leq -1.95 \cdot 10^{-125}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;d \leq -4.4 \cdot 10^{-262}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{2}\right)}^{-0.25}\\

\mathbf{elif}\;d \leq 3.1 \cdot 10^{-214}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.94999999999999991e-125 or -4.39999999999999977e-262 < d < 3.10000000000000004e-214

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

    if -1.94999999999999991e-125 < d < -4.39999999999999977e-262

    1. Initial program 56.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. Simplified56.7%

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{-1}}} \]
      3. metadata-eval17.7%

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

        \[\leadsto d \cdot \sqrt{{\left(\ell \cdot h\right)}^{\left(2 \cdot \color{blue}{\left(-0.25 + -0.25\right)}\right)}} \]
      5. pow-sqr17.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{\left(-0.25 + -0.25\right)} \cdot {\left(\ell \cdot h\right)}^{\left(-0.25 + -0.25\right)}}} \]
      6. pow-prod-up17.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\left({\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}\right)} \cdot {\left(\ell \cdot h\right)}^{\left(-0.25 + -0.25\right)}} \]
      7. pow-prod-up17.7%

        \[\leadsto d \cdot \sqrt{\left({\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}\right) \cdot \color{blue}{\left({\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}\right)}} \]
      8. sqrt-unprod17.7%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}} \cdot \sqrt{{\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}}\right)} \]
      9. add-sqr-sqrt17.7%

        \[\leadsto d \cdot \color{blue}{\left({\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}\right)} \]
      10. pow-prod-down33.0%

        \[\leadsto d \cdot \color{blue}{{\left(\left(\ell \cdot h\right) \cdot \left(\ell \cdot h\right)\right)}^{-0.25}} \]
      11. pow233.0%

        \[\leadsto d \cdot {\color{blue}{\left({\left(\ell \cdot h\right)}^{2}\right)}}^{-0.25} \]
    8. Applied egg-rr33.0%

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

    if 3.10000000000000004e-214 < d

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    10. Simplified57.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.95 \cdot 10^{-125}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-262}:\\ \;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{2}\right)}^{-0.25}\\ \mathbf{elif}\;d \leq 3.1 \cdot 10^{-214}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 47.4% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 69.6%

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

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

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

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

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

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

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

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

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

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

    if -1.45000000000000001e-226 < l < 1.59999999999999991e-282

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

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

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

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

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

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

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

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

    if 1.59999999999999991e-282 < l

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \color{blue}{\left|{\left(\ell \cdot h\right)}^{-0.5}\right|} \]
      6. rem-square-sqrt44.3%

        \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(\ell \cdot h\right)}^{-0.5}} \cdot \sqrt{{\left(\ell \cdot h\right)}^{-0.5}}}\right| \]
      7. fabs-sqr44.3%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(\ell \cdot h\right)}^{-0.5}} \cdot \sqrt{{\left(\ell \cdot h\right)}^{-0.5}}\right)} \]
      8. rem-square-sqrt44.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.45 \cdot 10^{-226}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{elif}\;\ell \leq 1.6 \cdot 10^{-282}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 46.8% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 85.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. Simplified87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9000000000000001e-138 < d < -1.000000000000002e-309

    1. Initial program 43.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. Simplified43.1%

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

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

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

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

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

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

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

        \[\leadsto d \cdot \sqrt{{\left(\ell \cdot h\right)}^{\left(2 \cdot \color{blue}{\left(-0.25 + -0.25\right)}\right)}} \]
      5. pow-sqr17.0%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{\left(-0.25 + -0.25\right)} \cdot {\left(\ell \cdot h\right)}^{\left(-0.25 + -0.25\right)}}} \]
      6. pow-prod-up17.0%

        \[\leadsto d \cdot \sqrt{\color{blue}{\left({\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}\right)} \cdot {\left(\ell \cdot h\right)}^{\left(-0.25 + -0.25\right)}} \]
      7. pow-prod-up17.0%

        \[\leadsto d \cdot \sqrt{\left({\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}\right) \cdot \color{blue}{\left({\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}\right)}} \]
      8. sqrt-unprod17.0%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}} \cdot \sqrt{{\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}}\right)} \]
      9. add-sqr-sqrt17.0%

        \[\leadsto d \cdot \color{blue}{\left({\left(\ell \cdot h\right)}^{-0.25} \cdot {\left(\ell \cdot h\right)}^{-0.25}\right)} \]
      10. pow-prod-down26.1%

        \[\leadsto d \cdot \color{blue}{{\left(\left(\ell \cdot h\right) \cdot \left(\ell \cdot h\right)\right)}^{-0.25}} \]
      11. pow226.1%

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

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

    if -1.000000000000002e-309 < d

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    10. Simplified47.8%

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

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

Alternative 14: 47.5% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 69.6%

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

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

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

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

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

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

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

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

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

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

    if -1.15e-226 < l < 2.94999999999999997e-294

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

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

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

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

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

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

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

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

    if 2.94999999999999997e-294 < l

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5} \cdot 1}{\sqrt{\ell}}} \]
      2. *-rgt-identity47.7%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    10. Simplified47.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.15 \cdot 10^{-226}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{elif}\;\ell \leq 2.95 \cdot 10^{-294}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 43.1% accurate, 2.9× speedup?

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

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

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


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

    1. Initial program 69.6%

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

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

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

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

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

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

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

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

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

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

    if -3e-227 < l

    1. Initial program 70.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3 \cdot 10^{-227}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 43.1% accurate, 3.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -4.7999999999999999e-227

    1. Initial program 69.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left|{\left(\ell \cdot h\right)}^{-0.5}\right|} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      7. rem-square-sqrt0.0%

        \[\leadsto \left|\color{blue}{\sqrt{{\left(\ell \cdot h\right)}^{-0.5}} \cdot \sqrt{{\left(\ell \cdot h\right)}^{-0.5}}}\right| \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      8. fabs-sqr0.0%

        \[\leadsto \color{blue}{\left(\sqrt{{\left(\ell \cdot h\right)}^{-0.5}} \cdot \sqrt{{\left(\ell \cdot h\right)}^{-0.5}}\right)} \cdot \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \]
      9. rem-square-sqrt0.0%

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

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

        \[\leadsto {\left(\ell \cdot h\right)}^{-0.5} \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \]
      12. rem-square-sqrt44.8%

        \[\leadsto {\left(\ell \cdot h\right)}^{-0.5} \cdot \left(\color{blue}{-1} \cdot d\right) \]
      13. neg-mul-144.8%

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

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

    if -4.7999999999999999e-227 < l

    1. Initial program 70.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.8 \cdot 10^{-227}:\\ \;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 26.7% accurate, 3.1× speedup?

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

\\
d \cdot \frac{1}{\sqrt{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 69.9%

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

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

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

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

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

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

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

    \[\leadsto d \cdot \frac{1}{\sqrt{\ell \cdot h}} \]
  8. Add Preprocessing

Alternative 18: 26.7% accurate, 3.1× speedup?

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

\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto d \cdot \sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{-0.5} \cdot {\left(\ell \cdot h\right)}^{-0.5}}} \]
    5. rem-sqrt-square27.3%

      \[\leadsto d \cdot \color{blue}{\left|{\left(\ell \cdot h\right)}^{-0.5}\right|} \]
    6. rem-square-sqrt27.3%

      \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(\ell \cdot h\right)}^{-0.5}} \cdot \sqrt{{\left(\ell \cdot h\right)}^{-0.5}}}\right| \]
    7. fabs-sqr27.3%

      \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(\ell \cdot h\right)}^{-0.5}} \cdot \sqrt{{\left(\ell \cdot h\right)}^{-0.5}}\right)} \]
    8. rem-square-sqrt27.3%

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

    \[\leadsto \color{blue}{d \cdot {\left(\ell \cdot h\right)}^{-0.5}} \]
  9. Final simplification27.3%

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

Reproduce

?
herbie shell --seed 2024096 
(FPCore (d h l M D)
  :name "Henrywood and Agarwal, Equation (12)"
  :precision binary64
  (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))