Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.0% → 79.7%
Time: 1.6min
Alternatives: 18
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 18 alternatives:

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

Initial Program: 67.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: 79.7% accurate, 0.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(\sqrt{d} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= h -1e-310)
   (*
    (/ (sqrt (- d)) (sqrt (- h)))
    (*
     (sqrt (/ d l))
     (+ 1.0 (* (/ h l) (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) -0.5)))))
   (*
    (/ (sqrt d) (sqrt h))
    (*
     (* (sqrt d) (sqrt (/ 1.0 l)))
     (+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -1e-310) {
		tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (pow((D / (d * (2.0 / M_m))), 2.0) * -0.5))));
	} else {
		tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) * sqrt((1.0 / l))) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0)))));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (h <= (-1d-310)) then
        tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0d0 + ((h / l) * (((d_1 / (d * (2.0d0 / m_m))) ** 2.0d0) * (-0.5d0)))))
    else
        tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) * sqrt((1.0d0 / l))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0)))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -1e-310) {
		tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (Math.sqrt((d / l)) * (1.0 + ((h / l) * (Math.pow((D / (d * (2.0 / M_m))), 2.0) * -0.5))));
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) * Math.sqrt((1.0 / l))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((M_m / 2.0) * (D / d)), 2.0)))));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if h <= -1e-310:
		tmp = (math.sqrt(-d) / math.sqrt(-h)) * (math.sqrt((d / l)) * (1.0 + ((h / l) * (math.pow((D / (d * (2.0 / M_m))), 2.0) * -0.5))))
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) * math.sqrt((1.0 / l))) * (1.0 + ((h / l) * (-0.5 * math.pow(((M_m / 2.0) * (D / d)), 2.0)))))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (h <= -1e-310)
		tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * -0.5)))));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) * sqrt(Float64(1.0 / l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (h <= -1e-310)
		tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (((D / (d * (2.0 / M_m))) ^ 2.0) * -0.5))));
	else
		tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) * sqrt((1.0 / l))) * (1.0 + ((h / l) * (-0.5 * (((M_m / 2.0) * (D / d)) ^ 2.0)))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right)\right)\\

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


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

    1. Initial program 71.2%

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < h

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 75.6% accurate, 0.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= h -1e-310)
   (*
    (sqrt (/ d h))
    (*
     (+ 1.0 (* (/ h l) (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) -0.5)))
     (/ (sqrt (- d)) (sqrt (- l)))))
   (*
    (fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
    (/ d (* (sqrt h) (sqrt l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -1e-310) {
		tmp = sqrt((d / h)) * ((1.0 + ((h / l) * (pow((D / (d * (2.0 / M_m))), 2.0) * -0.5))) * (sqrt(-d) / sqrt(-l)));
	} else {
		tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (h <= -1e-310)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * -0.5))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))));
	else
		tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\

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


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

    1. Initial program 71.2%

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < h

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 78.7% accurate, 0.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -2e-310)
   (*
    (/ (sqrt (- d)) (sqrt (- h)))
    (*
     (sqrt (/ d l))
     (+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0))))))
   (*
    (fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
    (/ d (* (sqrt h) (sqrt l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -2e-310) {
		tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0)))));
	} else {
		tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= -2e-310)
		tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))))));
	else
		tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\

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


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

    1. Initial program 71.2%

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 78.8% accurate, 0.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= h -1e-310)
   (*
    (/ (sqrt (- d)) (sqrt (- h)))
    (*
     (sqrt (/ d l))
     (+ 1.0 (* (/ h l) (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) -0.5)))))
   (*
    (fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
    (/ d (* (sqrt h) (sqrt l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -1e-310) {
		tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (pow((D / (d * (2.0 / M_m))), 2.0) * -0.5))));
	} else {
		tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (h <= -1e-310)
		tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * -0.5)))));
	else
		tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right)\right)\\

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


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

    1. Initial program 71.2%

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < h

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 73.9% accurate, 0.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= h -1e-310)
   (*
    (* (sqrt (/ d l)) (sqrt (/ d h)))
    (- 1.0 (* 0.5 (pow (* (* (/ D d) (* M_m 0.5)) (sqrt (/ h l))) 2.0))))
   (*
    (fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
    (/ d (* (sqrt h) (sqrt l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -1e-310) {
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * pow((((D / d) * (M_m * 0.5)) * sqrt((h / l))), 2.0)));
	} else {
		tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (h <= -1e-310)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(D / d) * Float64(M_m * 0.5)) * sqrt(Float64(h / l))) ^ 2.0))));
	else
		tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\

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


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

    1. Initial program 71.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified71.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. add-sqr-sqrt71.1%

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow173.5%

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

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

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

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

    if -9.999999999999969e-311 < h

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 73.4% accurate, 0.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= h -1e-310)
   (*
    (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
    (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)))))
   (*
    (fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
    (/ d (* (sqrt h) (sqrt l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -1e-310) {
		tmp = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
	} else {
		tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (h <= -1e-310)
		tmp = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0)))));
	else
		tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\

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


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

    1. Initial program 71.2%

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

    if -9.999999999999969e-311 < h

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 64.4% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -4.3 \cdot 10^{+191}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -1.9 \cdot 10^{-17}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq 5.5 \cdot 10^{-303}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{-0.5 \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\ \mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+147}:\\ \;\;\;\;\mathsf{fma}\left({\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, \frac{h \cdot -0.5}{\ell}, 1\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -4.3e+191)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (if (<= l -1.9e-17)
     (* d (- (sqrt (/ 1.0 (* h l)))))
     (if (<= l 5.5e-303)
       (*
        (sqrt (* (/ d l) (/ d h)))
        (+ 1.0 (/ (* -0.5 (pow (* (/ D d) (* M_m 0.5)) 2.0)) (/ l h))))
       (if (<= l 5.2e+147)
         (*
          (fma (pow (* D (/ M_m (* d 2.0))) 2.0) (/ (* h -0.5) l) 1.0)
          (/ d (sqrt (* h l))))
         (/ d (* (sqrt h) (sqrt l))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -4.3e+191) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (l <= -1.9e-17) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else if (l <= 5.5e-303) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h)));
	} else if (l <= 5.2e+147) {
		tmp = fma(pow((D * (M_m / (d * 2.0))), 2.0), ((h * -0.5) / l), 1.0) * (d / sqrt((h * l)));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= -4.3e+191)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (l <= -1.9e-17)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (l <= 5.5e-303)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(-0.5 * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / Float64(l / h))));
	elseif (l <= 5.2e+147)
		tmp = Float64(fma((Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h * -0.5) / l), 1.0) * Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -4.3e+191], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.9e-17], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 5.5e-303], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.2e+147], N[(N[(N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.3 \cdot 10^{+191}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

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

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

\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left({\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, \frac{h \cdot -0.5}{\ell}, 1\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if l < -4.2999999999999998e191

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

    if -4.2999999999999998e191 < l < -1.9000000000000001e-17

    1. Initial program 61.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. Simplified64.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. add-sqr-sqrt64.1%

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow166.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.9000000000000001e-17 < l < 5.50000000000000018e-303

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.50000000000000018e-303 < l < 5.1999999999999997e147

    1. Initial program 71.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)} \cdot e^{\log \left(\frac{d}{\sqrt{\ell \cdot h}}\right)} \]
      7. *-commutative73.6%

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

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

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

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

        \[\leadsto \mathsf{fma}\left({\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}, \color{blue}{\frac{-0.5 \cdot h}{\ell}}, 1\right) \cdot e^{\log \left(\frac{d}{\sqrt{\ell \cdot h}}\right)} \]
      12. rem-exp-log77.2%

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

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

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

    if 5.1999999999999997e147 < l

    1. Initial program 49.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. Simplified49.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. Applied egg-rr65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.3 \cdot 10^{+191}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -1.9 \cdot 10^{-17}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq 5.5 \cdot 10^{-303}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{-0.5 \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\ \mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+147}:\\ \;\;\;\;\mathsf{fma}\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h \cdot -0.5}{\ell}, 1\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 64.7% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.95 \cdot 10^{+191}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -2.8 \cdot 10^{-16}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq 2.35 \cdot 10^{-303}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{-0.5 \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\ \mathbf{elif}\;\ell \leq 3.9 \cdot 10^{+117}:\\ \;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -1.95e+191)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (if (<= l -2.8e-16)
     (* d (- (sqrt (/ 1.0 (* h l)))))
     (if (<= l 2.35e-303)
       (*
        (sqrt (* (/ d l) (/ d h)))
        (+ 1.0 (/ (* -0.5 (pow (* (/ D d) (* M_m 0.5)) 2.0)) (/ l h))))
       (if (<= l 3.9e+117)
         (/
          (* d (fma (/ h l) (* -0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)) 1.0))
          (sqrt (* h l)))
         (* d (/ (pow l -0.5) (sqrt h))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -1.95e+191) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (l <= -2.8e-16) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else if (l <= 2.35e-303) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h)));
	} else if (l <= 3.9e+117) {
		tmp = (d * fma((h / l), (-0.5 * pow(((D * M_m) / (d * 2.0)), 2.0)), 1.0)) / sqrt((h * l));
	} else {
		tmp = d * (pow(l, -0.5) / sqrt(h));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= -1.95e+191)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (l <= -2.8e-16)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (l <= 2.35e-303)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(-0.5 * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / Float64(l / h))));
	elseif (l <= 3.9e+117)
		tmp = Float64(Float64(d * fma(Float64(h / l), Float64(-0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0)), 1.0)) / sqrt(Float64(h * l)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1.95e+191], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2.8e-16], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.35e-303], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.9e+117], N[(N[(d * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.95 \cdot 10^{+191}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

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

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

\mathbf{elif}\;\ell \leq 3.9 \cdot 10^{+117}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if l < -1.95e191

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

    if -1.95e191 < l < -2.8000000000000001e-16

    1. Initial program 61.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. Simplified64.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. add-sqr-sqrt64.1%

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow166.8%

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

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

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

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

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

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

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

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

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

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

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

    if -2.8000000000000001e-16 < l < 2.3499999999999999e-303

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.3499999999999999e-303 < l < 3.8999999999999999e117

    1. Initial program 74.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. Simplified73.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. Applied egg-rr83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.8999999999999999e117 < l

    1. Initial program 47.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.95 \cdot 10^{+191}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -2.8 \cdot 10^{-16}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq 2.35 \cdot 10^{-303}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{-0.5 \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\ \mathbf{elif}\;\ell \leq 3.9 \cdot 10^{+117}:\\ \;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 67.7% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.1 \cdot 10^{+260}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;d \leq -9.6 \cdot 10^{-288}:\\ \;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(M\_m \cdot \frac{D \cdot 0.5}{d}\right)}^{2}, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= d -1.1e+260)
   (* d (- (sqrt (/ 1.0 (* h l)))))
   (if (<= d -9.6e-288)
     (*
      (fma (/ h l) (* -0.5 (pow (* M_m (/ (* D 0.5) d)) 2.0)) 1.0)
      (sqrt (* (/ d l) (/ d h))))
     (*
      (/ d (* (sqrt h) (sqrt l)))
      (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -1.1e+260) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else if (d <= -9.6e-288) {
		tmp = fma((h / l), (-0.5 * pow((M_m * ((D * 0.5) / d)), 2.0)), 1.0) * sqrt(((d / l) * (d / h)));
	} else {
		tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (d <= -1.1e+260)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (d <= -9.6e-288)
		tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M_m * Float64(Float64(D * 0.5) / d)) ^ 2.0)), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	else
		tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0)))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -1.1e+260], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -9.6e-288], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M$95$m * N[(N[(D * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.1 \cdot 10^{+260}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\

\mathbf{elif}\;d \leq -9.6 \cdot 10^{-288}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(M\_m \cdot \frac{D \cdot 0.5}{d}\right)}^{2}, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.10000000000000006e260

    1. Initial program 60.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. Simplified59.7%

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

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow159.6%

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

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

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

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

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

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

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

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

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

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

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

    if -1.10000000000000006e260 < d < -9.5999999999999994e-288

    1. Initial program 74.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified74.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. add-sqr-sqrt74.5%

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow177.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.5999999999999994e-288 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 73.4% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\\ \mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot t\_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot t\_0\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0 (pow (/ (* D M_m) (* d 2.0)) 2.0)))
   (if (<= h -1e-310)
     (*
      (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
      (- 1.0 (* (/ h l) (* 0.5 t_0))))
     (* (/ d (* (sqrt h) (sqrt l))) (+ 1.0 (* (/ h l) (* -0.5 t_0)))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double t_0 = pow(((D * M_m) / (d * 2.0)), 2.0);
	double tmp;
	if (h <= -1e-310) {
		tmp = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * t_0)));
	} else {
		tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * t_0)));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0
    if (h <= (-1d-310)) then
        tmp = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * t_0)))
    else
        tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((h / l) * ((-0.5d0) * t_0)))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double t_0 = Math.pow(((D * M_m) / (d * 2.0)), 2.0);
	double tmp;
	if (h <= -1e-310) {
		tmp = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * t_0)));
	} else {
		tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * t_0)));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	t_0 = math.pow(((D * M_m) / (d * 2.0)), 2.0)
	tmp = 0
	if h <= -1e-310:
		tmp = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * t_0)))
	else:
		tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * t_0)))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	t_0 = Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0
	tmp = 0.0
	if (h <= -1e-310)
		tmp = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * t_0))));
	else
		tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * t_0))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	t_0 = ((D * M_m) / (d * 2.0)) ^ 2.0;
	tmp = 0.0;
	if (h <= -1e-310)
		tmp = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * t_0)));
	else
		tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * t_0)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[h, -1e-310], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot t\_0\right)\right)\\

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


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

    1. Initial program 71.2%

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

    if -9.999999999999969e-311 < h

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 73.1% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 2.35 \cdot 10^{-303}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l 2.35e-303)
   (*
    (*
     (sqrt (/ d l))
     (+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
    (sqrt (/ d h)))
   (*
    (/ d (* (sqrt h) (sqrt l)))
    (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 2.35e-303) {
		tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0))))) * sqrt((d / h));
	} else {
		tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= 2.35d-303) then
        tmp = (sqrt((d / l)) * (1.0d0 + ((h / l) * ((-0.5d0) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))))) * sqrt((d / h))
    else
        tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 2.35e-303) {
		tmp = (Math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * Math.pow(((M_m / 2.0) * (D / d)), 2.0))))) * Math.sqrt((d / h));
	} else {
		tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D * M_m) / (d * 2.0)), 2.0))));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= 2.35e-303:
		tmp = (math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * math.pow(((M_m / 2.0) * (D / d)), 2.0))))) * math.sqrt((d / h))
	else:
		tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * math.pow(((D * M_m) / (d * 2.0)), 2.0))))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= 2.35e-303)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))))) * sqrt(Float64(d / h)));
	else
		tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0)))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= 2.35e-303)
		tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * (((M_m / 2.0) * (D / d)) ^ 2.0))))) * sqrt((d / h));
	else
		tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 2.35e-303], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.35 \cdot 10^{-303}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\

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


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

    1. Initial program 71.7%

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

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

    if 2.3499999999999999e-303 < l

    1. Initial program 64.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. 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. Applied egg-rr76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 73.3% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= h -1e-310)
   (*
    (*
     (sqrt (/ d l))
     (+ 1.0 (* (/ h l) (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) -0.5))))
    (sqrt (/ d h)))
   (*
    (/ d (* (sqrt h) (sqrt l)))
    (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -1e-310) {
		tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (pow((D / (d * (2.0 / M_m))), 2.0) * -0.5)))) * sqrt((d / h));
	} else {
		tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (h <= (-1d-310)) then
        tmp = (sqrt((d / l)) * (1.0d0 + ((h / l) * (((d_1 / (d * (2.0d0 / m_m))) ** 2.0d0) * (-0.5d0))))) * sqrt((d / h))
    else
        tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (h <= -1e-310) {
		tmp = (Math.sqrt((d / l)) * (1.0 + ((h / l) * (Math.pow((D / (d * (2.0 / M_m))), 2.0) * -0.5)))) * Math.sqrt((d / h));
	} else {
		tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D * M_m) / (d * 2.0)), 2.0))));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if h <= -1e-310:
		tmp = (math.sqrt((d / l)) * (1.0 + ((h / l) * (math.pow((D / (d * (2.0 / M_m))), 2.0) * -0.5)))) * math.sqrt((d / h))
	else:
		tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * math.pow(((D * M_m) / (d * 2.0)), 2.0))))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (h <= -1e-310)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * -0.5)))) * sqrt(Float64(d / h)));
	else
		tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0)))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (h <= -1e-310)
		tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (((D / (d * (2.0 / M_m))) ^ 2.0) * -0.5)))) * sqrt((d / h));
	else
		tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\

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


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

    1. Initial program 71.2%

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < h

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 57.6% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;D \leq 2.45 \cdot 10^{-14}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{-0.5 \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= D 2.45e-14)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (*
    (sqrt (* (/ d l) (/ d h)))
    (+ 1.0 (/ (* -0.5 (pow (* (/ D d) (* M_m 0.5)) 2.0)) (/ l h))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (D <= 2.45e-14) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h)));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d_1 <= 2.45d-14) then
        tmp = sqrt((d / l)) * sqrt((d / h))
    else
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + (((-0.5d0) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0)) / (l / h)))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (D <= 2.45e-14) {
		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
	} else {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * Math.pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h)));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if D <= 2.45e-14:
		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
	else:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * math.pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h)))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (D <= 2.45e-14)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	else
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(-0.5 * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / Float64(l / h))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (D <= 2.45e-14)
		tmp = sqrt((d / l)) * sqrt((d / h));
	else
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * (((D / d) * (M_m * 0.5)) ^ 2.0)) / (l / h)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[D, 2.45e-14], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 2.45 \cdot 10^{-14}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 2.44999999999999997e-14

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

    if 2.44999999999999997e-14 < D

    1. Initial program 67.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. Simplified68.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/67.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. div-inv67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 44.5% accurate, 1.5× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -7 \cdot 10^{+198}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 1.75 \cdot 10^{-169}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -7e+198)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (if (<= l 1.75e-169)
     (* d (- (pow (* h l) -0.5)))
     (* d (/ (pow l -0.5) (sqrt h))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -7e+198) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (l <= 1.75e-169) {
		tmp = d * -pow((h * l), -0.5);
	} else {
		tmp = d * (pow(l, -0.5) / sqrt(h));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-7d+198)) then
        tmp = sqrt((d / l)) * sqrt((d / h))
    else if (l <= 1.75d-169) then
        tmp = d * -((h * l) ** (-0.5d0))
    else
        tmp = d * ((l ** (-0.5d0)) / sqrt(h))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -7e+198) {
		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
	} else if (l <= 1.75e-169) {
		tmp = d * -Math.pow((h * l), -0.5);
	} else {
		tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= -7e+198:
		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
	elif l <= 1.75e-169:
		tmp = d * -math.pow((h * l), -0.5)
	else:
		tmp = d * (math.pow(l, -0.5) / math.sqrt(h))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= -7e+198)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (l <= 1.75e-169)
		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= -7e+198)
		tmp = sqrt((d / l)) * sqrt((d / h));
	elseif (l <= 1.75e-169)
		tmp = d * -((h * l) ^ -0.5);
	else
		tmp = d * ((l ^ -0.5) / sqrt(h));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -7e+198], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.75e-169], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7 \cdot 10^{+198}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

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

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


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

    1. Initial program 72.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. Simplified72.5%

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

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

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

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

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

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

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

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

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

    if -7.00000000000000026e198 < l < 1.7500000000000001e-169

    1. Initial program 72.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.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. add-sqr-sqrt72.3%

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow174.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{e^{\log \left(\ell \cdot h\right)}}}} \]
      5. rec-exp44.8%

        \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{e^{-\log \left(\ell \cdot h\right)}}} \]
      6. unpow1/244.8%

        \[\leadsto \left(-d\right) \cdot \color{blue}{{\left(e^{-\log \left(\ell \cdot h\right)}\right)}^{0.5}} \]
      7. exp-prod45.9%

        \[\leadsto \left(-d\right) \cdot \color{blue}{e^{\left(-\log \left(\ell \cdot h\right)\right) \cdot 0.5}} \]
      8. *-commutative45.9%

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{0.5 \cdot \left(-\log \left(\ell \cdot h\right)\right)}} \]
      9. distribute-rgt-neg-out45.9%

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{-0.5 \cdot \log \left(\ell \cdot h\right)}} \]
      10. distribute-lft-neg-in45.9%

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

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{-0.5} \cdot \log \left(\ell \cdot h\right)} \]
      12. *-commutative45.9%

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{\log \left(\ell \cdot h\right) \cdot -0.5}} \]
      13. exp-to-pow47.5%

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

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

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

    if 1.7500000000000001e-169 < 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. Simplified61.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 44.7% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 2.6 \cdot 10^{-169}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l 2.6e-169)
   (* d (- (pow (* h l) -0.5)))
   (* d (/ (pow l -0.5) (sqrt h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 2.6e-169) {
		tmp = d * -pow((h * l), -0.5);
	} else {
		tmp = d * (pow(l, -0.5) / sqrt(h));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= 2.6d-169) then
        tmp = d * -((h * l) ** (-0.5d0))
    else
        tmp = d * ((l ** (-0.5d0)) / sqrt(h))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 2.6e-169) {
		tmp = d * -Math.pow((h * l), -0.5);
	} else {
		tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= 2.6e-169:
		tmp = d * -math.pow((h * l), -0.5)
	else:
		tmp = d * (math.pow(l, -0.5) / math.sqrt(h))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= 2.6e-169)
		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= 2.6e-169)
		tmp = d * -((h * l) ^ -0.5);
	else
		tmp = d * ((l ^ -0.5) / sqrt(h));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 2.6e-169], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.6 \cdot 10^{-169}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\

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


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

    1. Initial program 72.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.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. add-sqr-sqrt72.3%

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow174.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{e^{\log \left(\ell \cdot h\right)}}}} \]
      5. rec-exp44.6%

        \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{e^{-\log \left(\ell \cdot h\right)}}} \]
      6. unpow1/244.6%

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

        \[\leadsto \left(-d\right) \cdot \color{blue}{e^{\left(-\log \left(\ell \cdot h\right)\right) \cdot 0.5}} \]
      8. *-commutative45.5%

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{0.5 \cdot \left(-\log \left(\ell \cdot h\right)\right)}} \]
      9. distribute-rgt-neg-out45.5%

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{-0.5 \cdot \log \left(\ell \cdot h\right)}} \]
      10. distribute-lft-neg-in45.5%

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

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{-0.5} \cdot \log \left(\ell \cdot h\right)} \]
      12. *-commutative45.5%

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{\log \left(\ell \cdot h\right) \cdot -0.5}} \]
      13. exp-to-pow47.2%

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

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

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

    if 2.60000000000000014e-169 < 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. Simplified61.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 41.9% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.8 \cdot 10^{-169}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l 1.8e-169)
   (* d (- (pow (* h l) -0.5)))
   (* d (sqrt (/ (/ 1.0 l) h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 1.8e-169) {
		tmp = d * -pow((h * l), -0.5);
	} else {
		tmp = d * sqrt(((1.0 / l) / h));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= 1.8d-169) then
        tmp = d * -((h * l) ** (-0.5d0))
    else
        tmp = d * sqrt(((1.0d0 / l) / h))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= 1.8e-169) {
		tmp = d * -Math.pow((h * l), -0.5);
	} else {
		tmp = d * Math.sqrt(((1.0 / l) / h));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= 1.8e-169:
		tmp = d * -math.pow((h * l), -0.5)
	else:
		tmp = d * math.sqrt(((1.0 / l) / h))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= 1.8e-169)
		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= 1.8e-169)
		tmp = d * -((h * l) ^ -0.5);
	else
		tmp = d * sqrt(((1.0 / l) / h));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 1.8e-169], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.8 \cdot 10^{-169}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\

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


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

    1. Initial program 72.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.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. add-sqr-sqrt72.3%

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

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

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

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

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
      6. pow174.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{e^{\log \left(\ell \cdot h\right)}}}} \]
      5. rec-exp44.6%

        \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{e^{-\log \left(\ell \cdot h\right)}}} \]
      6. unpow1/244.6%

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

        \[\leadsto \left(-d\right) \cdot \color{blue}{e^{\left(-\log \left(\ell \cdot h\right)\right) \cdot 0.5}} \]
      8. *-commutative45.5%

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{0.5 \cdot \left(-\log \left(\ell \cdot h\right)\right)}} \]
      9. distribute-rgt-neg-out45.5%

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{-0.5 \cdot \log \left(\ell \cdot h\right)}} \]
      10. distribute-lft-neg-in45.5%

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

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{-0.5} \cdot \log \left(\ell \cdot h\right)} \]
      12. *-commutative45.5%

        \[\leadsto \left(-d\right) \cdot e^{\color{blue}{\log \left(\ell \cdot h\right) \cdot -0.5}} \]
      13. exp-to-pow47.2%

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

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

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

    if 1.80000000000000001e-169 < 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. Simplified61.3%

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

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

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

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

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

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

Alternative 17: 26.8% accurate, 3.1× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	return d * sqrt(((1.0 / l) / h));
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    code = d * sqrt(((1.0d0 / l) / h))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	return d * Math.sqrt(((1.0 / l) / h));
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	return d * math.sqrt(((1.0 / l) / h))
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	return Float64(d * sqrt(Float64(Float64(1.0 / l) / h)))
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
	tmp = d * sqrt(((1.0 / l) / h));
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Derivation
  1. Initial program 67.7%

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

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

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

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

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

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

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

Alternative 18: 26.6% accurate, 3.1× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ d \cdot {\left(h \cdot \ell\right)}^{-0.5} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D) :precision binary64 (* d (pow (* h l) -0.5)))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	return d * pow((h * l), -0.5);
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    code = d * ((h * l) ** (-0.5d0))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	return d * Math.pow((h * l), -0.5);
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	return d * math.pow((h * l), -0.5)
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	return Float64(d * (Float64(h * l) ^ -0.5))
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
	tmp = d * ((h * l) ^ -0.5);
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 67.7%

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

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

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

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

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

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

      \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \]
    6. pow170.4%

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

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

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

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

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

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

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

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

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

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

      \[\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)} \]
    7. sqr-pow26.6%

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

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

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

Reproduce

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