Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.7% → 74.0%
Time: 23.5s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 65.7% accurate, 1.0× speedup?

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

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

Alternative 1: 74.0% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;\ell \leq -9.5 \cdot 10^{+123}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.5 \cdot {\left(t_1 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 2: 79.4% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 73.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2.15 \cdot 10^{+168}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\

\mathbf{elif}\;\ell \leq -4.4 \cdot 10^{+124}:\\
\;\;\;\;t_1 \cdot \left(t_2 \cdot \left(1 + \frac{1}{\ell} \cdot \left(-0.5 \cdot \left(h \cdot t_0\right)\right)\right)\right)\\

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 4: 75.0% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 5: 77.6% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 6: 72.8% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 72.2% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 8: 72.5% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 9: 73.3% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 10: 67.7% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 11: 58.0% accurate, 1.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 12: 46.3% accurate, 1.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 13: 42.8% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq 1.6 \cdot 10^{-204}:\\ \;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d 1.6e-204)
   (* (- 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 (d <= 1.6e-204) {
		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 (d <= 1.6d-204) 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 (d <= 1.6e-204) {
		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 d <= 1.6e-204:
		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 (d <= 1.6e-204)
		tmp = Float64(Float64(-d) * (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 (d <= 1.6e-204)
		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[d, 1.6e-204], 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}\;d \leq 1.6 \cdot 10^{-204}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 14: 26.3% 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
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 15: 26.3% 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
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Reproduce

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