Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.0% → 81.6%
Time: 22.6s
Alternatives: 17
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 67.0% accurate, 1.0× speedup?

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

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

Alternative 1: 81.6% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l

    1. Initial program 61.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. Simplified63.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. Step-by-step derivation
      1. associate-*r/68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 79.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{-306}:\\
\;\;\;\;\left(\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)\\

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


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

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

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

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

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

      \[\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 -4.59999999999999978e-306 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.6 \cdot 10^{-306}:\\ \;\;\;\;\left(\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)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot \left(0.25 \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 76.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\

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


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

    1. Initial program 32.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. Simplified32.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in 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-sqrt56.3%

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

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

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

    if -1.8200000000000001e143 < l < -9.999999999999969e-311

    1. Initial program 76.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. Simplified76.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. Step-by-step derivation
      1. associate-*r/79.0%

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l

    1. Initial program 61.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. Simplified63.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. Step-by-step derivation
      1. associate-*r/68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 74.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 32.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. Simplified32.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in 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-sqrt56.3%

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

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

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

    if -1.8e143 < l < -4.59999999999999978e-306

    1. Initial program 77.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. Simplified77.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

    if -4.59999999999999978e-306 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 74.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 32.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. Simplified32.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in 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-sqrt56.3%

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

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

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

    if -7.3999999999999995e142 < l < -4.59999999999999978e-306

    1. Initial program 77.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. Simplified76.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-/l/76.3%

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

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

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

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

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

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

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

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

    if -4.59999999999999978e-306 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 74.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 32.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. Simplified32.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in 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-sqrt56.3%

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

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

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

    if -8.60000000000000025e142 < l < -4.59999999999999978e-306

    1. Initial program 77.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. Simplified77.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. Step-by-step derivation
      1. associate-*r/79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999978e-306 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 74.1% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 32.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. Simplified32.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in 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-sqrt56.3%

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

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

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

    if -2.50000000000000006e143 < l < -4.59999999999999978e-306

    1. Initial program 77.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. Simplified77.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. Step-by-step derivation
      1. associate-*r/79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999978e-306 < l

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 71.4% accurate, 1.0× speedup?

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

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

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


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

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

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

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

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

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

    if -0.0012999999999999999 < l < -9.999999999999969e-311

    1. Initial program 76.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. Simplified76.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. Step-by-step derivation
      1. associate-*r/80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l

    1. Initial program 61.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. Simplified63.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 56.7% accurate, 1.4× speedup?

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

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

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

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

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


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

    1. Initial program 61.4%

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

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

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

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

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

    if -5.99999999999999983e-168 < l < -9.999999999999969e-311

    1. Initial program 80.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. Simplified80.5%

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

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

        \[\leadsto d \cdot \color{blue}{\log \left(e^{\sqrt{\frac{1}{h \cdot \ell}}}\right)} \]
      2. pow1/253.7%

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

        \[\leadsto d \cdot \log \left(e^{{\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}}\right) \]
      4. pow-pow53.7%

        \[\leadsto d \cdot \log \left(e^{\color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}}\right) \]
      5. metadata-eval53.7%

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

      \[\leadsto d \cdot \color{blue}{\log \left(e^{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
    7. Step-by-step derivation
      1. rem-log-exp22.9%

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

        \[\leadsto d \cdot \color{blue}{\left({\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \]
      3. pow-prod-down42.5%

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

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

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

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

    if -9.999999999999969e-311 < l < 1.35e91

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

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

        \[\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) \]
      2. sqrt-div82.6%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\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. frac-times82.6%

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

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

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

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

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

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

        \[\leadsto \left(1 \cdot \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\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. pow1/282.7%

        \[\leadsto \left(1 \cdot \frac{d}{\color{blue}{{h}^{0.5}} \cdot \sqrt{\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) \]
      4. pow1/282.7%

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

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \frac{d}{\sqrt{h \cdot \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) \]
    10. Step-by-step derivation
      1. *-lft-identity78.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 - 0.125 \cdot \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)\right) \]
      11. swap-sqr78.0%

        \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 - 0.125 \cdot \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)\right) \]
      12. unpow278.0%

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

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

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

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

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

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

    if 1.35e91 < l

    1. Initial program 44.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. Simplified49.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. Step-by-step derivation
      1. sqrt-div67.6%

        \[\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) \]
      2. sqrt-div72.8%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\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. frac-times72.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \color{blue}{\frac{1}{{\left(h \cdot \ell\right)}^{0.5}}} \]
      3. pow1/252.2%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \]
      4. div-inv52.3%

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

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

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
      7. clear-num68.5%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 67.1% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

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


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

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

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

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

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

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

    if -0.27000000000000002 < l < -9.999999999999969e-311

    1. Initial program 76.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. Simplified76.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. Step-by-step derivation
      1. associate-*r/80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l

    1. Initial program 61.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. Simplified63.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. Step-by-step derivation
      1. sqrt-div76.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) \]
      2. sqrt-div79.3%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\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. frac-times79.3%

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

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

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

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

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

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

        \[\leadsto \left(1 \cdot \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\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. pow1/279.3%

        \[\leadsto \left(1 \cdot \frac{d}{\color{blue}{{h}^{0.5}} \cdot \sqrt{\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) \]
      4. pow1/279.3%

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

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \frac{d}{\sqrt{h \cdot \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) \]
    10. Step-by-step derivation
      1. *-lft-identity68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 57.4% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 61.4%

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

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

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

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

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

    if -3.5000000000000003e-169 < l < -4.79999999999999987e-286

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

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

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

        \[\leadsto d \cdot \color{blue}{\log \left(e^{\sqrt{\frac{1}{h \cdot \ell}}}\right)} \]
      2. pow1/258.9%

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

        \[\leadsto d \cdot \log \left(e^{{\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}}\right) \]
      4. pow-pow58.9%

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

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

      \[\leadsto d \cdot \color{blue}{\log \left(e^{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
    7. Step-by-step derivation
      1. rem-log-exp25.1%

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

        \[\leadsto d \cdot \color{blue}{\left({\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \]
      3. pow-prod-down46.6%

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

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

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

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

    if -4.79999999999999987e-286 < l

    1. Initial program 61.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. Simplified62.8%

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

        \[\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) \]
      2. sqrt-div77.4%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\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. frac-times77.4%

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

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

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

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

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

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

        \[\leadsto \left(1 \cdot \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\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. pow1/277.4%

        \[\leadsto \left(1 \cdot \frac{d}{\color{blue}{{h}^{0.5}} \cdot \sqrt{\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) \]
      4. pow1/277.4%

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

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \frac{d}{\sqrt{h \cdot \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) \]
    10. Step-by-step derivation
      1. *-lft-identity66.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 47.0% accurate, 1.6× speedup?

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

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

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


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

    1. Initial program 65.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. Simplified65.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in 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-sqrt49.3%

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

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

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

    if 1.24999999999999992e-276 < l

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

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. sqrt-div76.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) \]
      2. sqrt-div79.4%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\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. frac-times79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \color{blue}{\frac{1}{{\left(h \cdot \ell\right)}^{0.5}}} \]
      3. pow1/246.8%

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

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
      5. sqrt-prod56.0%

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

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
    12. Applied egg-rr53.7%

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

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    14. Simplified56.0%

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

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

Alternative 13: 43.5% accurate, 2.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\


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

    1. Initial program 66.3%

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

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

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

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

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

    if 3.6000000000000002e-255 < l

    1. Initial program 61.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. Simplified63.1%

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

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

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

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

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

Alternative 14: 43.4% accurate, 2.9× speedup?

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

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

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


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

    1. Initial program 66.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.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. Step-by-step derivation
      1. sqrt-div8.1%

        \[\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) \]
      2. sqrt-div8.1%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\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. frac-times8.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
    11. Taylor expanded in h around -inf 0.0%

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

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

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

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

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

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

    if 5.60000000000000023e-255 < l

    1. Initial program 61.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. Simplified63.1%

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

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

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

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

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

Alternative 15: 43.4% accurate, 3.0× speedup?

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

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

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.05000000000000012e-256 < l

    1. Initial program 61.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. Simplified63.1%

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

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

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

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

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

Alternative 16: 43.4% accurate, 3.0× speedup?

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

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

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.3999999999999998e-255 < l

    1. Initial program 61.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. Simplified63.1%

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

        \[\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) \]
      2. sqrt-div79.2%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\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. frac-times79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \color{blue}{\frac{1}{{\left(h \cdot \ell\right)}^{0.5}}} \]
      3. pow1/247.5%

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

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

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

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

Alternative 17: 26.8% accurate, 3.2× speedup?

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

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

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

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

      \[\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) \]
    2. sqrt-div37.8%

      \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\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. frac-times37.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto d \cdot \color{blue}{\frac{1}{{\left(h \cdot \ell\right)}^{0.5}}} \]
    3. pow1/226.3%

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

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

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  13. Final simplification26.4%

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

Reproduce

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