Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.2% → 79.4%
Time: 16.8s
Alternatives: 19
Speedup: 3.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 66.2% accurate, 1.0× speedup?

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

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

Alternative 1: 79.4% accurate, 1.3× 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 -5.8 \cdot 10^{-304}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(h \cdot {\left(\frac{M\_m \cdot \frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\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 (<= d -5.8e-304)
   (*
    (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
    (- 1.0 (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
   (*
    (/ (fma (* h (pow (/ (* M_m (/ D d)) 2.0) 2.0)) (/ -0.5 l) 1.0) (sqrt h))
    (/ d (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 (d <= -5.8e-304) {
		tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
	} else {
		tmp = (fma((h * pow(((M_m * (D / d)) / 2.0), 2.0)), (-0.5 / l), 1.0) / sqrt(h)) * (d / 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 (d <= -5.8e-304)
		tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))));
	else
		tmp = Float64(Float64(fma(Float64(h * (Float64(Float64(M_m * Float64(D / d)) / 2.0) ^ 2.0)), Float64(-0.5 / l), 1.0) / sqrt(h)) * Float64(d / 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[d, -5.8e-304], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(h * N[Power[N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / 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}\;d \leq -5.8 \cdot 10^{-304}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\

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


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

    1. Initial program 73.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    5. Step-by-step derivation
      1. lift-pow.f64N/A

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

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

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

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      5. lift-/.f64N/A

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

        \[\leadsto \left(\sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      7. sqrt-divN/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      8. lower-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      9. lower-sqrt.f64N/A

        \[\leadsto \left(\frac{\color{blue}{\sqrt{\mathsf{neg}\left(d\right)}}}{\sqrt{\mathsf{neg}\left(h\right)}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      10. lower-neg.f64N/A

        \[\leadsto \left(\frac{\sqrt{\color{blue}{-d}}}{\sqrt{\mathsf{neg}\left(h\right)}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      11. lower-sqrt.f64N/A

        \[\leadsto \left(\frac{\sqrt{-d}}{\color{blue}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      12. lower-neg.f6484.8

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

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

    if -5.8e-304 < 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. Add Preprocessing
    3. Applied rewrites58.5%

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

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

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

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

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

Alternative 2: 62.8% accurate, 0.3× 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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \sqrt{\frac{d}{h}}\\ t_2 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{+40}:\\ \;\;\;\;\left(\left(\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{M\_m \cdot M\_m}{\ell}\right)\right) \cdot t\_1\right) \cdot t\_2\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;t\_1 \cdot t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.25 \cdot \sqrt{h}, \left(\left(M\_m \cdot M\_m\right) \cdot D\right) \cdot D, \left(\ell \cdot d\right) \cdot \sqrt{{h}^{-1}}\right)}{\ell}}{\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
 (let* ((t_0
         (*
          (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
          (-
           1.0
           (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l)))))
        (t_1 (sqrt (/ d h)))
        (t_2 (sqrt (/ d l))))
   (if (<= t_0 -2e+40)
     (* (* (* (* -0.125 (/ (/ (* D D) d) d)) (* h (/ (* M_m M_m) l))) t_1) t_2)
     (if (<= t_0 INFINITY)
       (* t_1 t_2)
       (/
        (/
         (fma
          (* -0.25 (sqrt h))
          (* (* (* M_m M_m) D) D)
          (* (* l d) (sqrt (pow h -1.0))))
         l)
        (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 t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
	double t_1 = sqrt((d / h));
	double t_2 = sqrt((d / l));
	double tmp;
	if (t_0 <= -2e+40) {
		tmp = (((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * t_1) * t_2;
	} else if (t_0 <= ((double) INFINITY)) {
		tmp = t_1 * t_2;
	} else {
		tmp = (fma((-0.25 * sqrt(h)), (((M_m * M_m) * D) * D), ((l * d) * sqrt(pow(h, -1.0)))) / l) / 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)
	t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	t_1 = sqrt(Float64(d / h))
	t_2 = sqrt(Float64(d / l))
	tmp = 0.0
	if (t_0 <= -2e+40)
		tmp = Float64(Float64(Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)) * Float64(h * Float64(Float64(M_m * M_m) / l))) * t_1) * t_2);
	elseif (t_0 <= Inf)
		tmp = Float64(t_1 * t_2);
	else
		tmp = Float64(Float64(fma(Float64(-0.25 * sqrt(h)), Float64(Float64(Float64(M_m * M_m) * D) * D), Float64(Float64(l * d) * sqrt((h ^ -1.0)))) / l) / 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_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -2e+40], N[(N[(N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$1 * t$95$2), $MachinePrecision], N[(N[(N[(N[(-0.25 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] + N[(N[(l * d), $MachinePrecision] * N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / N[Sqrt[l], $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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+40}:\\
\;\;\;\;\left(\left(\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{M\_m \cdot M\_m}{\ell}\right)\right) \cdot t\_1\right) \cdot t\_2\\

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_1 \cdot t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000006e40

    1. Initial program 91.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. Add Preprocessing
    3. Applied rewrites43.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \color{blue}{\frac{\frac{{D}^{2}}{d}}{d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      7. lower-/.f64N/A

        \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \color{blue}{\frac{\frac{{D}^{2}}{d}}{d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      8. lower-/.f64N/A

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

        \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{\color{blue}{D \cdot D}}{d}}{d}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{\color{blue}{D \cdot D}}{d}}{d}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      11. *-commutativeN/A

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

        \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \color{blue}{\left(h \cdot \frac{{M}^{2}}{\ell}\right)}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      13. lower-*.f64N/A

        \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \color{blue}{\left(h \cdot \frac{{M}^{2}}{\ell}\right)}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      14. lower-/.f64N/A

        \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \color{blue}{\frac{{M}^{2}}{\ell}}\right)\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      15. unpow2N/A

        \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{\color{blue}{M \cdot M}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      16. lower-*.f6472.6

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

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

    if -2.00000000000000006e40 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

    1. Initial program 76.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. Add Preprocessing
    3. Applied rewrites67.9%

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

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(\sqrt{\frac{d}{h}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \cdot \sqrt{\frac{d}{\ell}} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{d}{h}}\right)}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      2. unpow2N/A

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

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

        \[\leadsto \color{blue}{\left(\left(-1 \cdot -1\right) \cdot \sqrt{\frac{d}{h}}\right)} \cdot \sqrt{\frac{d}{\ell}} \]
      5. metadata-evalN/A

        \[\leadsto \left(\color{blue}{1} \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      6. *-lft-identityN/A

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      7. lower-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      8. lower-/.f6473.6

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

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

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

    1. Initial program 0.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\frac{-1}{4} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \sqrt{h}\right) + \left(d \cdot \ell\right) \cdot \sqrt{\frac{1}{h}}}{\ell}}}{\sqrt{\ell}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

Alternative 3: 48.7% accurate, 0.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}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+76}:\\ \;\;\;\;\left(\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{M\_m \cdot M\_m}{\ell}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\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 (<=
      (*
       (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
       (-
        1.0
        (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
      -5e+76)
   (*
    (* (* -0.125 (/ (/ (* D D) d) d)) (* h (/ (* M_m M_m) l)))
    (/ d (sqrt (* l h))))
   (* (sqrt (/ d h)) (sqrt (/ d 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 (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76) {
		tmp = ((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * (d / sqrt((l * h)));
	} else {
		tmp = sqrt((d / h)) * sqrt((d / l));
	}
	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 / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-5d+76)) then
        tmp = (((-0.125d0) * (((d_1 * d_1) / d) / d)) * (h * ((m_m * m_m) / l))) * (d / sqrt((l * h)))
    else
        tmp = sqrt((d / h)) * sqrt((d / l))
    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 (((Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76) {
		tmp = ((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * (d / Math.sqrt((l * h)));
	} else {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	}
	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 ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76:
		tmp = ((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * (d / math.sqrt((l * h)))
	else:
		tmp = math.sqrt((d / h)) * math.sqrt((d / 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 (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -5e+76)
		tmp = Float64(Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)) * Float64(h * Float64(Float64(M_m * M_m) / l))) * Float64(d / sqrt(Float64(l * h))));
	else
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	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 / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -5e+76)
		tmp = ((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * (d / sqrt((l * h)));
	else
		tmp = sqrt((d / h)) * sqrt((d / l));
	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[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+76], N[(N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / 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}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+76}:\\
\;\;\;\;\left(\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{M\_m \cdot M\_m}{\ell}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999991e76

    1. Initial program 91.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. Add Preprocessing
    3. Applied rewrites44.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \color{blue}{\frac{\frac{{D}^{2}}{d}}{d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
      7. lower-/.f64N/A

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \color{blue}{\frac{\frac{{D}^{2}}{d}}{d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
      8. lower-/.f64N/A

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

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \frac{\frac{\color{blue}{D \cdot D}}{d}}{d}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \frac{\frac{\color{blue}{D \cdot D}}{d}}{d}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
      11. *-commutativeN/A

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

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \color{blue}{\left(h \cdot \frac{{M}^{2}}{\ell}\right)}\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
      13. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \color{blue}{\left(h \cdot \frac{{M}^{2}}{\ell}\right)}\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
      14. lower-/.f64N/A

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \color{blue}{\frac{{M}^{2}}{\ell}}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
      15. unpow2N/A

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{\color{blue}{M \cdot M}}{\ell}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
      16. lower-*.f6442.5

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

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

    if -4.99999999999999991e76 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

    1. Initial program 58.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. Add Preprocessing
    3. Applied rewrites55.2%

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

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(\sqrt{\frac{d}{h}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \cdot \sqrt{\frac{d}{\ell}} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{d}{h}}\right)}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      2. unpow2N/A

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

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

        \[\leadsto \color{blue}{\left(\left(-1 \cdot -1\right) \cdot \sqrt{\frac{d}{h}}\right)} \cdot \sqrt{\frac{d}{\ell}} \]
      5. metadata-evalN/A

        \[\leadsto \left(\color{blue}{1} \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
      6. *-lft-identityN/A

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      7. lower-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      8. lower-/.f6459.7

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
    8. Applied rewrites59.7%

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

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

Alternative 4: 49.8% accurate, 0.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}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+76}:\\ \;\;\;\;\left(\left(M\_m \cdot M\_m\right) \cdot \left(\frac{D \cdot D}{d} \cdot -0.125\right)\right) \cdot \frac{\sqrt{\frac{h}{\ell}}}{\left|\ell\right|}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\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 (<=
      (*
       (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
       (-
        1.0
        (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
      -5e+76)
   (* (* (* M_m M_m) (* (/ (* D D) d) -0.125)) (/ (sqrt (/ h l)) (fabs l)))
   (* (sqrt (/ d h)) (sqrt (/ d 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 (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76) {
		tmp = ((M_m * M_m) * (((D * D) / d) * -0.125)) * (sqrt((h / l)) / fabs(l));
	} else {
		tmp = sqrt((d / h)) * sqrt((d / l));
	}
	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 / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-5d+76)) then
        tmp = ((m_m * m_m) * (((d_1 * d_1) / d) * (-0.125d0))) * (sqrt((h / l)) / abs(l))
    else
        tmp = sqrt((d / h)) * sqrt((d / l))
    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 (((Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76) {
		tmp = ((M_m * M_m) * (((D * D) / d) * -0.125)) * (Math.sqrt((h / l)) / Math.abs(l));
	} else {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	}
	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 ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76:
		tmp = ((M_m * M_m) * (((D * D) / d) * -0.125)) * (math.sqrt((h / l)) / math.fabs(l))
	else:
		tmp = math.sqrt((d / h)) * math.sqrt((d / 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 (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -5e+76)
		tmp = Float64(Float64(Float64(M_m * M_m) * Float64(Float64(Float64(D * D) / d) * -0.125)) * Float64(sqrt(Float64(h / l)) / abs(l)));
	else
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	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 / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -5e+76)
		tmp = ((M_m * M_m) * (((D * D) / d) * -0.125)) * (sqrt((h / l)) / abs(l));
	else
		tmp = sqrt((d / h)) * sqrt((d / l));
	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[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+76], N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / 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}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+76}:\\
\;\;\;\;\left(\left(M\_m \cdot M\_m\right) \cdot \left(\frac{D \cdot D}{d} \cdot -0.125\right)\right) \cdot \frac{\sqrt{\frac{h}{\ell}}}{\left|\ell\right|}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999991e76

    1. Initial program 91.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left({M}^{2} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2}}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      11. lower-*.f64N/A

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

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

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

      if -4.99999999999999991e76 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

      1. Initial program 58.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. Add Preprocessing
      3. Applied rewrites55.2%

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot \left(\sqrt{\frac{d}{h}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \cdot \sqrt{\frac{d}{\ell}} \]
      7. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \left(-1 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{d}{h}}\right)}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        2. unpow2N/A

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

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

          \[\leadsto \color{blue}{\left(\left(-1 \cdot -1\right) \cdot \sqrt{\frac{d}{h}}\right)} \cdot \sqrt{\frac{d}{\ell}} \]
        5. metadata-evalN/A

          \[\leadsto \left(\color{blue}{1} \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        6. *-lft-identityN/A

          \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
        7. lower-sqrt.f64N/A

          \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
        8. lower-/.f6459.7

          \[\leadsto \sqrt{\color{blue}{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      8. Applied rewrites59.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
    9. Recombined 2 regimes into one program.
    10. Final simplification54.8%

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

    Alternative 5: 77.0% accurate, 1.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 -3.75 \cdot 10^{-180}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{D}{d} \cdot M\_m}{2}\right)}^{2} \cdot 0.5}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(h \cdot {\left(\frac{M\_m \cdot \frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\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 -3.75e-180)
       (*
        (*
         (fma (/ (* (pow (/ (* (/ D d) M_m) 2.0) 2.0) 0.5) (- l)) h 1.0)
         (sqrt (/ d h)))
        (/ (sqrt (- d)) (sqrt (- l))))
       (if (<= h -2e-310)
         (* (- d) (sqrt (pow (* l h) -1.0)))
         (*
          (/ (fma (* h (pow (/ (* M_m (/ D d)) 2.0) 2.0)) (/ -0.5 l) 1.0) (sqrt h))
          (/ d (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 <= -3.75e-180) {
    		tmp = (fma(((pow((((D / d) * M_m) / 2.0), 2.0) * 0.5) / -l), h, 1.0) * sqrt((d / h))) * (sqrt(-d) / sqrt(-l));
    	} else if (h <= -2e-310) {
    		tmp = -d * sqrt(pow((l * h), -1.0));
    	} else {
    		tmp = (fma((h * pow(((M_m * (D / d)) / 2.0), 2.0)), (-0.5 / l), 1.0) / sqrt(h)) * (d / 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 <= -3.75e-180)
    		tmp = Float64(Float64(fma(Float64(Float64((Float64(Float64(Float64(D / d) * M_m) / 2.0) ^ 2.0) * 0.5) / Float64(-l)), h, 1.0) * sqrt(Float64(d / h))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))));
    	elseif (h <= -2e-310)
    		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
    	else
    		tmp = Float64(Float64(fma(Float64(h * (Float64(Float64(M_m * Float64(D / d)) / 2.0) ^ 2.0)), Float64(-0.5 / l), 1.0) / sqrt(h)) * Float64(d / 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, -3.75e-180], N[(N[(N[(N[(N[(N[Power[N[(N[(N[(D / d), $MachinePrecision] * M$95$m), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] / (-l)), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(h * N[Power[N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / 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}\;h \leq -3.75 \cdot 10^{-180}:\\
    \;\;\;\;\left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{D}{d} \cdot M\_m}{2}\right)}^{2} \cdot 0.5}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
    
    \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
    \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(h \cdot {\left(\frac{M\_m \cdot \frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if h < -3.75000000000000008e-180

      1. Initial program 79.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. Add Preprocessing
      3. Applied rewrites45.3%

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

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

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

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

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

          \[\leadsto \left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(\ell\right)}}} \]
        4. lift-neg.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{\mathsf{neg}\left(d\right)}{\color{blue}{-\ell}}} \]
        5. sqrt-divN/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{-\ell}}} \]
        6. lower-/.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{-\ell}}} \]
        7. lower-sqrt.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \frac{\color{blue}{\sqrt{\mathsf{neg}\left(d\right)}}}{\sqrt{-\ell}} \]
        8. lower-neg.f64N/A

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

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

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

      if -3.75000000000000008e-180 < h < -1.999999999999994e-310

      1. Initial program 50.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. Add Preprocessing
      3. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        2. unpow2N/A

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

          \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        4. mul-1-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        5. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
        6. lower-neg.f64N/A

          \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        7. lower-sqrt.f64N/A

          \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
        8. lower-/.f64N/A

          \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
        9. *-commutativeN/A

          \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
        10. lower-*.f6481.6

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

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

      if -1.999999999999994e-310 < h

      1. Initial program 63.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. Add Preprocessing
      3. Applied rewrites59.0%

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

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

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

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

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

    Alternative 6: 74.5% accurate, 2.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 -6.5 \cdot 10^{-180}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{M\_m \cdot D}{d}}{2}\right)}^{2} \cdot 0.5}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(h \cdot {\left(\frac{M\_m \cdot \frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\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 -6.5e-180)
       (*
        (*
         (fma (/ (* (pow (/ (/ (* M_m D) d) 2.0) 2.0) 0.5) (- l)) h 1.0)
         (sqrt (/ d h)))
        (sqrt (/ d l)))
       (if (<= h -2e-310)
         (* (- d) (sqrt (pow (* l h) -1.0)))
         (*
          (/ (fma (* h (pow (/ (* M_m (/ D d)) 2.0) 2.0)) (/ -0.5 l) 1.0) (sqrt h))
          (/ d (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 <= -6.5e-180) {
    		tmp = (fma(((pow((((M_m * D) / d) / 2.0), 2.0) * 0.5) / -l), h, 1.0) * sqrt((d / h))) * sqrt((d / l));
    	} else if (h <= -2e-310) {
    		tmp = -d * sqrt(pow((l * h), -1.0));
    	} else {
    		tmp = (fma((h * pow(((M_m * (D / d)) / 2.0), 2.0)), (-0.5 / l), 1.0) / sqrt(h)) * (d / 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 <= -6.5e-180)
    		tmp = Float64(Float64(fma(Float64(Float64((Float64(Float64(Float64(M_m * D) / d) / 2.0) ^ 2.0) * 0.5) / Float64(-l)), h, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
    	elseif (h <= -2e-310)
    		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
    	else
    		tmp = Float64(Float64(fma(Float64(h * (Float64(Float64(M_m * Float64(D / d)) / 2.0) ^ 2.0)), Float64(-0.5 / l), 1.0) / sqrt(h)) * Float64(d / 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, -6.5e-180], N[(N[(N[(N[(N[(N[Power[N[(N[(N[(M$95$m * D), $MachinePrecision] / d), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] / (-l)), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(h * N[Power[N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / 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}\;h \leq -6.5 \cdot 10^{-180}:\\
    \;\;\;\;\left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{M\_m \cdot D}{d}}{2}\right)}^{2} \cdot 0.5}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
    
    \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
    \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(h \cdot {\left(\frac{M\_m \cdot \frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if h < -6.50000000000000013e-180

      1. Initial program 79.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. Add Preprocessing
      3. Applied rewrites45.3%

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

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

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot 0.5}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
      6. Step-by-step derivation
        1. lift-*.f64N/A

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

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

          \[\leadsto \left(\mathsf{fma}\left(\frac{{\left(\frac{\color{blue}{\frac{D \cdot M}{d}}}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        4. lift-*.f64N/A

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

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

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

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

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

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

      if -6.50000000000000013e-180 < h < -1.999999999999994e-310

      1. Initial program 50.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. Add Preprocessing
      3. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        2. unpow2N/A

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

          \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        4. mul-1-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        5. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
        6. lower-neg.f64N/A

          \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        7. lower-sqrt.f64N/A

          \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
        8. lower-/.f64N/A

          \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
        9. *-commutativeN/A

          \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
        10. lower-*.f6481.6

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

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

      if -1.999999999999994e-310 < h

      1. Initial program 63.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. Add Preprocessing
      3. Applied rewrites59.0%

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

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

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

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

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

    Alternative 7: 74.8% accurate, 2.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 := \frac{M\_m \cdot \frac{D}{d}}{2}\\ \mathbf{if}\;h \leq -6.5 \cdot 10^{-180}:\\ \;\;\;\;\left(\mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{-0.5}{\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(h \cdot {t\_0}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\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
     (let* ((t_0 (/ (* M_m (/ D d)) 2.0)))
       (if (<= h -6.5e-180)
         (*
          (* (fma (* t_0 (* t_0 (/ -0.5 l))) h 1.0) (sqrt (/ d h)))
          (sqrt (/ d l)))
         (if (<= h -2e-310)
           (* (- d) (sqrt (pow (* l h) -1.0)))
           (*
            (/ (fma (* h (pow t_0 2.0)) (/ -0.5 l) 1.0) (sqrt h))
            (/ d (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 t_0 = (M_m * (D / d)) / 2.0;
    	double tmp;
    	if (h <= -6.5e-180) {
    		tmp = (fma((t_0 * (t_0 * (-0.5 / l))), h, 1.0) * sqrt((d / h))) * sqrt((d / l));
    	} else if (h <= -2e-310) {
    		tmp = -d * sqrt(pow((l * h), -1.0));
    	} else {
    		tmp = (fma((h * pow(t_0, 2.0)), (-0.5 / l), 1.0) / sqrt(h)) * (d / 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)
    	t_0 = Float64(Float64(M_m * Float64(D / d)) / 2.0)
    	tmp = 0.0
    	if (h <= -6.5e-180)
    		tmp = Float64(Float64(fma(Float64(t_0 * Float64(t_0 * Float64(-0.5 / l))), h, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
    	elseif (h <= -2e-310)
    		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
    	else
    		tmp = Float64(Float64(fma(Float64(h * (t_0 ^ 2.0)), Float64(-0.5 / l), 1.0) / sqrt(h)) * Float64(d / 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_] := Block[{t$95$0 = N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[h, -6.5e-180], N[(N[(N[(N[(t$95$0 * N[(t$95$0 * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(h * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / 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}
    t_0 := \frac{M\_m \cdot \frac{D}{d}}{2}\\
    \mathbf{if}\;h \leq -6.5 \cdot 10^{-180}:\\
    \;\;\;\;\left(\mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{-0.5}{\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
    
    \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
    \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(h \cdot {t\_0}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if h < -6.50000000000000013e-180

      1. Initial program 79.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. Add Preprocessing
      3. Applied rewrites45.3%

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

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

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

          \[\leadsto \left(\mathsf{fma}\left(\color{blue}{\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        2. lift-*.f64N/A

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

          \[\leadsto \left(\mathsf{fma}\left(\color{blue}{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{\frac{1}{2}}{-\ell}}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        4. lift-pow.f64N/A

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

          \[\leadsto \left(\mathsf{fma}\left(\color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{D}{d} \cdot M}{2}\right)} \cdot \frac{\frac{1}{2}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        6. associate-*l*N/A

          \[\leadsto \left(\mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        7. lower-*.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        8. lift-*.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{\color{blue}{\frac{D}{d} \cdot M}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        9. *-commutativeN/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        10. lower-*.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        11. lower-*.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        12. lift-*.f64N/A

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

          \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        14. lower-*.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        15. metadata-evalN/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\color{blue}{\mathsf{neg}\left(\frac{-1}{2}\right)}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        16. metadata-evalN/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\color{blue}{\frac{1}{2} \cdot -1}\right)}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        17. lift-neg.f64N/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\frac{1}{2} \cdot -1\right)}{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        18. frac-2negN/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\frac{\frac{1}{2} \cdot -1}{\ell}}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
        19. lower-/.f64N/A

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

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

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

      if -6.50000000000000013e-180 < h < -1.999999999999994e-310

      1. Initial program 50.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. Add Preprocessing
      3. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        2. unpow2N/A

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

          \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        4. mul-1-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        5. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
        6. lower-neg.f64N/A

          \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
        7. lower-sqrt.f64N/A

          \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
        8. lower-/.f64N/A

          \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
        9. *-commutativeN/A

          \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
        10. lower-*.f6481.6

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

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

      if -1.999999999999994e-310 < h

      1. Initial program 63.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. Add Preprocessing
      3. Applied rewrites59.0%

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

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

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

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

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

    Alternative 8: 54.7% accurate, 2.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 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;h \leq -2.3 \cdot 10^{-142}:\\ \;\;\;\;\frac{\left(1 \cdot t\_0\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;h \leq 2.7 \cdot 10^{+71}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(D \cdot M\_m, \left(D \cdot M\_m\right) \cdot \left(\frac{h}{\ell \cdot d} \cdot -0.25\right), 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.25 \cdot \sqrt{h}, \left(\left(M\_m \cdot M\_m\right) \cdot D\right) \cdot D, \left(\ell \cdot d\right) \cdot \sqrt{{h}^{-1}}\right)}{\ell}}{\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
     (let* ((t_0 (sqrt (/ d h))))
       (if (<= h -2.3e-142)
         (/ (* (* 1.0 t_0) (sqrt (- d))) (sqrt (- l)))
         (if (<= h -2e-310)
           (* (- d) (sqrt (pow (* l h) -1.0)))
           (if (<= h 2.7e+71)
             (/
              (*
               (* (fma (* D M_m) (* (* D M_m) (* (/ h (* l d)) -0.25)) 1.0) t_0)
               (sqrt d))
              (sqrt l))
             (/
              (/
               (fma
                (* -0.25 (sqrt h))
                (* (* (* M_m M_m) D) D)
                (* (* l d) (sqrt (pow h -1.0))))
               l)
              (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 t_0 = sqrt((d / h));
    	double tmp;
    	if (h <= -2.3e-142) {
    		tmp = ((1.0 * t_0) * sqrt(-d)) / sqrt(-l);
    	} else if (h <= -2e-310) {
    		tmp = -d * sqrt(pow((l * h), -1.0));
    	} else if (h <= 2.7e+71) {
    		tmp = ((fma((D * M_m), ((D * M_m) * ((h / (l * d)) * -0.25)), 1.0) * t_0) * sqrt(d)) / sqrt(l);
    	} else {
    		tmp = (fma((-0.25 * sqrt(h)), (((M_m * M_m) * D) * D), ((l * d) * sqrt(pow(h, -1.0)))) / l) / 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)
    	t_0 = sqrt(Float64(d / h))
    	tmp = 0.0
    	if (h <= -2.3e-142)
    		tmp = Float64(Float64(Float64(1.0 * t_0) * sqrt(Float64(-d))) / sqrt(Float64(-l)));
    	elseif (h <= -2e-310)
    		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
    	elseif (h <= 2.7e+71)
    		tmp = Float64(Float64(Float64(fma(Float64(D * M_m), Float64(Float64(D * M_m) * Float64(Float64(h / Float64(l * d)) * -0.25)), 1.0) * t_0) * sqrt(d)) / sqrt(l));
    	else
    		tmp = Float64(Float64(fma(Float64(-0.25 * sqrt(h)), Float64(Float64(Float64(M_m * M_m) * D) * D), Float64(Float64(l * d) * sqrt((h ^ -1.0)))) / l) / 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_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2.3e-142], N[(N[(N[(1.0 * t$95$0), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.7e+71], N[(N[(N[(N[(N[(D * M$95$m), $MachinePrecision] * N[(N[(D * M$95$m), $MachinePrecision] * N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.25 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] + N[(N[(l * d), $MachinePrecision] * N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / N[Sqrt[l], $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 := \sqrt{\frac{d}{h}}\\
    \mathbf{if}\;h \leq -2.3 \cdot 10^{-142}:\\
    \;\;\;\;\frac{\left(1 \cdot t\_0\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
    
    \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
    \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
    
    \mathbf{elif}\;h \leq 2.7 \cdot 10^{+71}:\\
    \;\;\;\;\frac{\left(\mathsf{fma}\left(D \cdot M\_m, \left(D \cdot M\_m\right) \cdot \left(\frac{h}{\ell \cdot d} \cdot -0.25\right), 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{\ell}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.25 \cdot \sqrt{h}, \left(\left(M\_m \cdot M\_m\right) \cdot D\right) \cdot D, \left(\ell \cdot d\right) \cdot \sqrt{{h}^{-1}}\right)}{\ell}}{\sqrt{\ell}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if h < -2.30000000000000002e-142

      1. Initial program 80.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
      3. Taylor expanded in d around inf

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

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
          3. lift-*.f64N/A

            \[\leadsto 1 \cdot \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
          4. lift-pow.f64N/A

            \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}}\right) \]
          5. lift-/.f64N/A

            \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \]
          6. metadata-evalN/A

            \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
          7. pow1/2N/A

            \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \]
          8. lift-sqrt.f64N/A

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

            \[\leadsto \color{blue}{\left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
          10. lift-sqrt.f64N/A

            \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
          11. lift-/.f64N/A

            \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{d}{\ell}}} \]
          12. frac-2negN/A

            \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(\ell\right)}}} \]
          13. sqrt-divN/A

            \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}}} \]
        3. Applied rewrites55.1%

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

        if -2.30000000000000002e-142 < h < -1.999999999999994e-310

        1. Initial program 58.0%

          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-pow.f64N/A

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

            \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
          2. unpow2N/A

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

            \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
          4. mul-1-negN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
          6. lower-neg.f64N/A

            \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
          7. lower-sqrt.f64N/A

            \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
          8. lower-/.f64N/A

            \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
          9. *-commutativeN/A

            \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
          10. lower-*.f6473.4

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

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

        if -1.999999999999994e-310 < h < 2.69999999999999997e71

        1. Initial program 75.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. Add Preprocessing
        3. Step-by-step derivation
          1. lift-pow.f64N/A

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\left(\left(\color{blue}{{\left(D \cdot M\right)}^{2} \cdot \left(\frac{-1}{4} \cdot \frac{h}{d \cdot \ell}\right)} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          4. lift-pow.f64N/A

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

            \[\leadsto \frac{\left(\left(\color{blue}{\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)} \cdot \left(\frac{-1}{4} \cdot \frac{h}{d \cdot \ell}\right) + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          6. associate-*l*N/A

            \[\leadsto \frac{\left(\left(\color{blue}{\left(D \cdot M\right) \cdot \left(\left(D \cdot M\right) \cdot \left(\frac{-1}{4} \cdot \frac{h}{d \cdot \ell}\right)\right)} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          7. lower-fma.f64N/A

            \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\frac{-1}{4} \cdot \frac{h}{d \cdot \ell}\right), 1\right)} \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          8. lower-*.f64N/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \color{blue}{\left(D \cdot M\right) \cdot \left(\frac{-1}{4} \cdot \frac{h}{d \cdot \ell}\right)}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          9. *-commutativeN/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \color{blue}{\left(\frac{h}{d \cdot \ell} \cdot \frac{-1}{4}\right)}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          10. lower-*.f6474.0

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \color{blue}{\left(\frac{h}{d \cdot \ell} \cdot -0.25\right)}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          11. lift-/.f64N/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\color{blue}{\frac{h}{d \cdot \ell}} \cdot \frac{-1}{4}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          12. lift-*.f64N/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\frac{h}{\color{blue}{d \cdot \ell}} \cdot \frac{-1}{4}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          13. *-commutativeN/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\frac{h}{\color{blue}{\ell \cdot d}} \cdot \frac{-1}{4}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          14. associate-/r*N/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\color{blue}{\frac{\frac{h}{\ell}}{d}} \cdot \frac{-1}{4}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          15. lower-/.f64N/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\color{blue}{\frac{\frac{h}{\ell}}{d}} \cdot \frac{-1}{4}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          16. lower-/.f6471.3

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\frac{\color{blue}{\frac{h}{\ell}}}{d} \cdot -0.25\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
        7. Applied rewrites71.3%

          \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\frac{\frac{h}{\ell}}{d} \cdot -0.25\right), 1\right)} \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
        8. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\color{blue}{\frac{\frac{h}{\ell}}{d}} \cdot \frac{-1}{4}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\frac{\color{blue}{\frac{h}{\ell}}}{d} \cdot \frac{-1}{4}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          3. associate-/l/N/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\color{blue}{\frac{h}{\ell \cdot d}} \cdot \frac{-1}{4}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          4. lower-/.f64N/A

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\color{blue}{\frac{h}{\ell \cdot d}} \cdot \frac{-1}{4}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
          5. lower-*.f6474.0

            \[\leadsto \frac{\left(\mathsf{fma}\left(D \cdot M, \left(D \cdot M\right) \cdot \left(\frac{h}{\color{blue}{\ell \cdot d}} \cdot -0.25\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{d}}{\sqrt{\ell}} \]
        9. Applied rewrites74.0%

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

        if 2.69999999999999997e71 < h

        1. Initial program 47.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. Add Preprocessing
        3. Step-by-step derivation
          1. lift-pow.f64N/A

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\frac{\frac{-1}{4} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \sqrt{h}\right) + \left(d \cdot \ell\right) \cdot \sqrt{\frac{1}{h}}}{\ell}}}{\sqrt{\ell}} \]
        7. Step-by-step derivation
          1. lower-/.f64N/A

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

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

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

      Alternative 9: 51.9% accurate, 2.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 -2.3 \cdot 10^{-142}:\\ \;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{elif}\;h \leq 5 \cdot 10^{-309}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.25 \cdot \sqrt{h}, \left(\left(M\_m \cdot M\_m\right) \cdot D\right) \cdot D, \left(\ell \cdot d\right) \cdot \sqrt{{h}^{-1}}\right)}{\ell}}{\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 -2.3e-142)
         (/ (* (* 1.0 (sqrt (/ d h))) (sqrt (- d))) (sqrt (- l)))
         (if (<= h 5e-309)
           (* (- d) (sqrt (pow (* l h) -1.0)))
           (/
            (/
             (fma
              (* -0.25 (sqrt h))
              (* (* (* M_m M_m) D) D)
              (* (* l d) (sqrt (pow h -1.0))))
             l)
            (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 <= -2.3e-142) {
      		tmp = ((1.0 * sqrt((d / h))) * sqrt(-d)) / sqrt(-l);
      	} else if (h <= 5e-309) {
      		tmp = -d * sqrt(pow((l * h), -1.0));
      	} else {
      		tmp = (fma((-0.25 * sqrt(h)), (((M_m * M_m) * D) * D), ((l * d) * sqrt(pow(h, -1.0)))) / l) / 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 <= -2.3e-142)
      		tmp = Float64(Float64(Float64(1.0 * sqrt(Float64(d / h))) * sqrt(Float64(-d))) / sqrt(Float64(-l)));
      	elseif (h <= 5e-309)
      		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
      	else
      		tmp = Float64(Float64(fma(Float64(-0.25 * sqrt(h)), Float64(Float64(Float64(M_m * M_m) * D) * D), Float64(Float64(l * d) * sqrt((h ^ -1.0)))) / l) / 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, -2.3e-142], N[(N[(N[(1.0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5e-309], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.25 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] + N[(N[(l * d), $MachinePrecision] * N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / N[Sqrt[l], $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 -2.3 \cdot 10^{-142}:\\
      \;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
      
      \mathbf{elif}\;h \leq 5 \cdot 10^{-309}:\\
      \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.25 \cdot \sqrt{h}, \left(\left(M\_m \cdot M\_m\right) \cdot D\right) \cdot D, \left(\ell \cdot d\right) \cdot \sqrt{{h}^{-1}}\right)}{\ell}}{\sqrt{\ell}}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if h < -2.30000000000000002e-142

        1. Initial program 80.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
        3. Taylor expanded in d around inf

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

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
            3. lift-*.f64N/A

              \[\leadsto 1 \cdot \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
            4. lift-pow.f64N/A

              \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}}\right) \]
            5. lift-/.f64N/A

              \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \]
            6. metadata-evalN/A

              \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
            7. pow1/2N/A

              \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \]
            8. lift-sqrt.f64N/A

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

              \[\leadsto \color{blue}{\left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
            10. lift-sqrt.f64N/A

              \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
            11. lift-/.f64N/A

              \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{d}{\ell}}} \]
            12. frac-2negN/A

              \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(\ell\right)}}} \]
            13. sqrt-divN/A

              \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}}} \]
          3. Applied rewrites55.1%

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

          if -2.30000000000000002e-142 < h < 4.9999999999999995e-309

          1. Initial program 58.0%

            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-pow.f64N/A

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

              \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
            2. unpow2N/A

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

              \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
            4. mul-1-negN/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
            5. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
            6. lower-neg.f64N/A

              \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
            7. lower-sqrt.f64N/A

              \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
            8. lower-/.f64N/A

              \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
            9. *-commutativeN/A

              \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
            10. lower-*.f6473.4

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

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

          if 4.9999999999999995e-309 < h

          1. Initial program 63.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. Add Preprocessing
          3. Step-by-step derivation
            1. lift-pow.f64N/A

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{\frac{\frac{-1}{4} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \sqrt{h}\right) + \left(d \cdot \ell\right) \cdot \sqrt{\frac{1}{h}}}{\ell}}}{\sqrt{\ell}} \]
          7. Step-by-step derivation
            1. lower-/.f64N/A

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

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

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

        Alternative 10: 50.1% accurate, 2.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} t_0 := \sqrt{-d}\\ \mathbf{if}\;d \leq -7.5 \cdot 10^{-63}:\\ \;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_0}{\sqrt{-h}}\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0}{\sqrt{-\ell}}\\ \mathbf{elif}\;d \leq 1.15 \cdot 10^{-35}:\\ \;\;\;\;\frac{\left(-0.25 \cdot \sqrt{h}\right) \cdot \left(\frac{M\_m \cdot M\_m}{\ell} \cdot \left(D \cdot D\right)\right)}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\ \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 (sqrt (- d))))
           (if (<= d -7.5e-63)
             (/ (* (* 1.0 (sqrt (/ d l))) t_0) (sqrt (- h)))
             (if (<= d -5e-310)
               (/ (* (* 1.0 (sqrt (/ d h))) t_0) (sqrt (- l)))
               (if (<= d 1.15e-35)
                 (/ (* (* -0.25 (sqrt h)) (* (/ (* M_m M_m) l) (* D D))) (sqrt l))
                 (* (pow (* (sqrt l) (sqrt h)) -1.0) d))))))
        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 = sqrt(-d);
        	double tmp;
        	if (d <= -7.5e-63) {
        		tmp = ((1.0 * sqrt((d / l))) * t_0) / sqrt(-h);
        	} else if (d <= -5e-310) {
        		tmp = ((1.0 * sqrt((d / h))) * t_0) / sqrt(-l);
        	} else if (d <= 1.15e-35) {
        		tmp = ((-0.25 * sqrt(h)) * (((M_m * M_m) / l) * (D * D))) / sqrt(l);
        	} else {
        		tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
        	}
        	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 = sqrt(-d)
            if (d <= (-7.5d-63)) then
                tmp = ((1.0d0 * sqrt((d / l))) * t_0) / sqrt(-h)
            else if (d <= (-5d-310)) then
                tmp = ((1.0d0 * sqrt((d / h))) * t_0) / sqrt(-l)
            else if (d <= 1.15d-35) then
                tmp = (((-0.25d0) * sqrt(h)) * (((m_m * m_m) / l) * (d_1 * d_1))) / sqrt(l)
            else
                tmp = ((sqrt(l) * sqrt(h)) ** (-1.0d0)) * d
            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.sqrt(-d);
        	double tmp;
        	if (d <= -7.5e-63) {
        		tmp = ((1.0 * Math.sqrt((d / l))) * t_0) / Math.sqrt(-h);
        	} else if (d <= -5e-310) {
        		tmp = ((1.0 * Math.sqrt((d / h))) * t_0) / Math.sqrt(-l);
        	} else if (d <= 1.15e-35) {
        		tmp = ((-0.25 * Math.sqrt(h)) * (((M_m * M_m) / l) * (D * D))) / Math.sqrt(l);
        	} else {
        		tmp = Math.pow((Math.sqrt(l) * Math.sqrt(h)), -1.0) * d;
        	}
        	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.sqrt(-d)
        	tmp = 0
        	if d <= -7.5e-63:
        		tmp = ((1.0 * math.sqrt((d / l))) * t_0) / math.sqrt(-h)
        	elif d <= -5e-310:
        		tmp = ((1.0 * math.sqrt((d / h))) * t_0) / math.sqrt(-l)
        	elif d <= 1.15e-35:
        		tmp = ((-0.25 * math.sqrt(h)) * (((M_m * M_m) / l) * (D * D))) / math.sqrt(l)
        	else:
        		tmp = math.pow((math.sqrt(l) * math.sqrt(h)), -1.0) * d
        	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 = sqrt(Float64(-d))
        	tmp = 0.0
        	if (d <= -7.5e-63)
        		tmp = Float64(Float64(Float64(1.0 * sqrt(Float64(d / l))) * t_0) / sqrt(Float64(-h)));
        	elseif (d <= -5e-310)
        		tmp = Float64(Float64(Float64(1.0 * sqrt(Float64(d / h))) * t_0) / sqrt(Float64(-l)));
        	elseif (d <= 1.15e-35)
        		tmp = Float64(Float64(Float64(-0.25 * sqrt(h)) * Float64(Float64(Float64(M_m * M_m) / l) * Float64(D * D))) / sqrt(l));
        	else
        		tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d);
        	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 = sqrt(-d);
        	tmp = 0.0;
        	if (d <= -7.5e-63)
        		tmp = ((1.0 * sqrt((d / l))) * t_0) / sqrt(-h);
        	elseif (d <= -5e-310)
        		tmp = ((1.0 * sqrt((d / h))) * t_0) / sqrt(-l);
        	elseif (d <= 1.15e-35)
        		tmp = ((-0.25 * sqrt(h)) * (((M_m * M_m) / l) * (D * D))) / sqrt(l);
        	else
        		tmp = ((sqrt(l) * sqrt(h)) ^ -1.0) * d;
        	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[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -7.5e-63], N[(N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[(1.0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-35], N[(N[(N[(-0.25 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $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 := \sqrt{-d}\\
        \mathbf{if}\;d \leq -7.5 \cdot 10^{-63}:\\
        \;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_0}{\sqrt{-h}}\\
        
        \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
        \;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0}{\sqrt{-\ell}}\\
        
        \mathbf{elif}\;d \leq 1.15 \cdot 10^{-35}:\\
        \;\;\;\;\frac{\left(-0.25 \cdot \sqrt{h}\right) \cdot \left(\frac{M\_m \cdot M\_m}{\ell} \cdot \left(D \cdot D\right)\right)}{\sqrt{\ell}}\\
        
        \mathbf{else}:\\
        \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if d < -7.5000000000000003e-63

          1. Initial program 79.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
          3. Taylor expanded in d around inf

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

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
            2. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1} \]
              2. lift-*.f64N/A

                \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot 1 \]
              3. lift-pow.f64N/A

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}}\right) \cdot 1 \]
              4. lift-/.f64N/A

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

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot 1 \]
              6. pow1/2N/A

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot 1 \]
              7. lift-sqrt.f64N/A

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot 1 \]
              8. associate-*l*N/A

                \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)} \]
              9. *-commutativeN/A

                \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}} \]
              10. lift-pow.f64N/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}} \]
              11. lift-/.f64N/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \]
              12. metadata-evalN/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\frac{1}{2}}} \]
              13. unpow1/2N/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \color{blue}{\sqrt{\frac{d}{h}}} \]
              14. lift-/.f64N/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \sqrt{\color{blue}{\frac{d}{h}}} \]
              15. frac-2negN/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(h\right)}}} \]
              16. sqrt-divN/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \]
            3. Applied rewrites68.7%

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

            if -7.5000000000000003e-63 < d < -4.999999999999985e-310

            1. Initial program 62.3%

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

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

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
              2. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1} \]
                2. *-commutativeN/A

                  \[\leadsto \color{blue}{1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
                3. lift-*.f64N/A

                  \[\leadsto 1 \cdot \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
                4. lift-pow.f64N/A

                  \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}}\right) \]
                5. lift-/.f64N/A

                  \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \]
                6. metadata-evalN/A

                  \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
                7. pow1/2N/A

                  \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \]
                8. lift-sqrt.f64N/A

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

                  \[\leadsto \color{blue}{\left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
                10. lift-sqrt.f64N/A

                  \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
                11. lift-/.f64N/A

                  \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{d}{\ell}}} \]
                12. frac-2negN/A

                  \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(\ell\right)}}} \]
                13. sqrt-divN/A

                  \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}}} \]
              3. Applied rewrites44.9%

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

              if -4.999999999999985e-310 < d < 1.1499999999999999e-35

              1. Initial program 56.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. Add Preprocessing
              3. Step-by-step derivation
                1. lift-pow.f64N/A

                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

                \[\leadsto \frac{\color{blue}{\frac{-1}{4} \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{\ell} \cdot \sqrt{h}\right)}}{\sqrt{\ell}} \]
              7. Step-by-step derivation
                1. *-commutativeN/A

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

                  \[\leadsto \frac{\color{blue}{\left(\frac{-1}{4} \cdot \sqrt{h}\right) \cdot \frac{{D}^{2} \cdot {M}^{2}}{\ell}}}{\sqrt{\ell}} \]
                3. lower-*.f64N/A

                  \[\leadsto \frac{\color{blue}{\left(\frac{-1}{4} \cdot \sqrt{h}\right) \cdot \frac{{D}^{2} \cdot {M}^{2}}{\ell}}}{\sqrt{\ell}} \]
                4. lower-*.f64N/A

                  \[\leadsto \frac{\color{blue}{\left(\frac{-1}{4} \cdot \sqrt{h}\right)} \cdot \frac{{D}^{2} \cdot {M}^{2}}{\ell}}{\sqrt{\ell}} \]
                5. lower-sqrt.f64N/A

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

                  \[\leadsto \frac{\left(\frac{-1}{4} \cdot \sqrt{h}\right) \cdot \color{blue}{\left({D}^{2} \cdot \frac{{M}^{2}}{\ell}\right)}}{\sqrt{\ell}} \]
                7. *-commutativeN/A

                  \[\leadsto \frac{\left(\frac{-1}{4} \cdot \sqrt{h}\right) \cdot \color{blue}{\left(\frac{{M}^{2}}{\ell} \cdot {D}^{2}\right)}}{\sqrt{\ell}} \]
                8. lower-*.f64N/A

                  \[\leadsto \frac{\left(\frac{-1}{4} \cdot \sqrt{h}\right) \cdot \color{blue}{\left(\frac{{M}^{2}}{\ell} \cdot {D}^{2}\right)}}{\sqrt{\ell}} \]
                9. lower-/.f64N/A

                  \[\leadsto \frac{\left(\frac{-1}{4} \cdot \sqrt{h}\right) \cdot \left(\color{blue}{\frac{{M}^{2}}{\ell}} \cdot {D}^{2}\right)}{\sqrt{\ell}} \]
                10. unpow2N/A

                  \[\leadsto \frac{\left(\frac{-1}{4} \cdot \sqrt{h}\right) \cdot \left(\frac{\color{blue}{M \cdot M}}{\ell} \cdot {D}^{2}\right)}{\sqrt{\ell}} \]
                11. lower-*.f64N/A

                  \[\leadsto \frac{\left(\frac{-1}{4} \cdot \sqrt{h}\right) \cdot \left(\frac{\color{blue}{M \cdot M}}{\ell} \cdot {D}^{2}\right)}{\sqrt{\ell}} \]
                12. unpow2N/A

                  \[\leadsto \frac{\left(\frac{-1}{4} \cdot \sqrt{h}\right) \cdot \left(\frac{M \cdot M}{\ell} \cdot \color{blue}{\left(D \cdot D\right)}\right)}{\sqrt{\ell}} \]
                13. lower-*.f6443.8

                  \[\leadsto \frac{\left(-0.25 \cdot \sqrt{h}\right) \cdot \left(\frac{M \cdot M}{\ell} \cdot \color{blue}{\left(D \cdot D\right)}\right)}{\sqrt{\ell}} \]
              8. Applied rewrites43.8%

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

              if 1.1499999999999999e-35 < d

              1. Initial program 71.5%

                \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-pow.f64N/A

                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

                \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
              6. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                3. lower-sqrt.f64N/A

                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                4. lower-/.f64N/A

                  \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                5. *-commutativeN/A

                  \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                6. lower-*.f6461.1

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

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

                  \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
                2. Step-by-step derivation
                  1. Applied rewrites63.8%

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

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

                Alternative 11: 48.0% accurate, 2.9× 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 -2.3 \cdot 10^{-142}:\\ \;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\ \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 -2.3e-142)
                   (/ (* (* 1.0 (sqrt (/ d h))) (sqrt (- d))) (sqrt (- l)))
                   (if (<= h -2e-310)
                     (* (- d) (sqrt (pow (* l h) -1.0)))
                     (* (pow (* (sqrt l) (sqrt h)) -1.0) d))))
                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 <= -2.3e-142) {
                		tmp = ((1.0 * sqrt((d / h))) * sqrt(-d)) / sqrt(-l);
                	} else if (h <= -2e-310) {
                		tmp = -d * sqrt(pow((l * h), -1.0));
                	} else {
                		tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
                	}
                	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 <= (-2.3d-142)) then
                        tmp = ((1.0d0 * sqrt((d / h))) * sqrt(-d)) / sqrt(-l)
                    else if (h <= (-2d-310)) then
                        tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                    else
                        tmp = ((sqrt(l) * sqrt(h)) ** (-1.0d0)) * d
                    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 <= -2.3e-142) {
                		tmp = ((1.0 * Math.sqrt((d / h))) * Math.sqrt(-d)) / Math.sqrt(-l);
                	} else if (h <= -2e-310) {
                		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                	} else {
                		tmp = Math.pow((Math.sqrt(l) * Math.sqrt(h)), -1.0) * d;
                	}
                	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 <= -2.3e-142:
                		tmp = ((1.0 * math.sqrt((d / h))) * math.sqrt(-d)) / math.sqrt(-l)
                	elif h <= -2e-310:
                		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                	else:
                		tmp = math.pow((math.sqrt(l) * math.sqrt(h)), -1.0) * d
                	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 <= -2.3e-142)
                		tmp = Float64(Float64(Float64(1.0 * sqrt(Float64(d / h))) * sqrt(Float64(-d))) / sqrt(Float64(-l)));
                	elseif (h <= -2e-310)
                		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                	else
                		tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d);
                	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 <= -2.3e-142)
                		tmp = ((1.0 * sqrt((d / h))) * sqrt(-d)) / sqrt(-l);
                	elseif (h <= -2e-310)
                		tmp = -d * sqrt(((l * h) ^ -1.0));
                	else
                		tmp = ((sqrt(l) * sqrt(h)) ^ -1.0) * d;
                	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, -2.3e-142], N[(N[(N[(1.0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $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 -2.3 \cdot 10^{-142}:\\
                \;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
                
                \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
                \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                
                \mathbf{else}:\\
                \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if h < -2.30000000000000002e-142

                  1. Initial program 80.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
                  3. Taylor expanded in d around inf

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

                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                    2. Step-by-step derivation
                      1. lift-*.f64N/A

                        \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1} \]
                      2. *-commutativeN/A

                        \[\leadsto \color{blue}{1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
                      3. lift-*.f64N/A

                        \[\leadsto 1 \cdot \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
                      4. lift-pow.f64N/A

                        \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}}\right) \]
                      5. lift-/.f64N/A

                        \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \]
                      6. metadata-evalN/A

                        \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
                      7. pow1/2N/A

                        \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \]
                      8. lift-sqrt.f64N/A

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

                        \[\leadsto \color{blue}{\left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
                      10. lift-sqrt.f64N/A

                        \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
                      11. lift-/.f64N/A

                        \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{d}{\ell}}} \]
                      12. frac-2negN/A

                        \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(\ell\right)}}} \]
                      13. sqrt-divN/A

                        \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}}} \]
                    3. Applied rewrites55.1%

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

                    if -2.30000000000000002e-142 < h < -1.999999999999994e-310

                    1. Initial program 58.0%

                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-pow.f64N/A

                        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                      2. unpow2N/A

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

                        \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                      4. mul-1-negN/A

                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                      5. lower-*.f64N/A

                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                      6. lower-neg.f64N/A

                        \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                      7. lower-sqrt.f64N/A

                        \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                      8. lower-/.f64N/A

                        \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                      9. *-commutativeN/A

                        \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                      10. lower-*.f6473.4

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

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

                    if -1.999999999999994e-310 < h

                    1. Initial program 63.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. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-pow.f64N/A

                        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

                      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                    6. Step-by-step derivation
                      1. *-commutativeN/A

                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                      2. lower-*.f64N/A

                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                      3. lower-sqrt.f64N/A

                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                      4. lower-/.f64N/A

                        \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                      5. *-commutativeN/A

                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                      6. lower-*.f6443.5

                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                    7. Applied rewrites43.5%

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

                        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
                      2. Step-by-step derivation
                        1. Applied rewrites46.8%

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

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

                      Alternative 12: 46.2% accurate, 2.9× 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 -8.2 \cdot 10^{-144}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\ \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 -8.2e-144)
                         (* (sqrt (/ d h)) (sqrt (/ d l)))
                         (if (<= h -2e-310)
                           (* (- d) (sqrt (pow (* l h) -1.0)))
                           (* (pow (* (sqrt l) (sqrt h)) -1.0) d))))
                      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 <= -8.2e-144) {
                      		tmp = sqrt((d / h)) * sqrt((d / l));
                      	} else if (h <= -2e-310) {
                      		tmp = -d * sqrt(pow((l * h), -1.0));
                      	} else {
                      		tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
                      	}
                      	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 <= (-8.2d-144)) then
                              tmp = sqrt((d / h)) * sqrt((d / l))
                          else if (h <= (-2d-310)) then
                              tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                          else
                              tmp = ((sqrt(l) * sqrt(h)) ** (-1.0d0)) * d
                          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 <= -8.2e-144) {
                      		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
                      	} else if (h <= -2e-310) {
                      		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                      	} else {
                      		tmp = Math.pow((Math.sqrt(l) * Math.sqrt(h)), -1.0) * d;
                      	}
                      	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 <= -8.2e-144:
                      		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
                      	elif h <= -2e-310:
                      		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                      	else:
                      		tmp = math.pow((math.sqrt(l) * math.sqrt(h)), -1.0) * d
                      	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 <= -8.2e-144)
                      		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
                      	elseif (h <= -2e-310)
                      		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                      	else
                      		tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d);
                      	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 <= -8.2e-144)
                      		tmp = sqrt((d / h)) * sqrt((d / l));
                      	elseif (h <= -2e-310)
                      		tmp = -d * sqrt(((l * h) ^ -1.0));
                      	else
                      		tmp = ((sqrt(l) * sqrt(h)) ^ -1.0) * d;
                      	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, -8.2e-144], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $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 -8.2 \cdot 10^{-144}:\\
                      \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
                      
                      \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
                      \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if h < -8.2e-144

                        1. Initial program 80.4%

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

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

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

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

                          \[\leadsto \color{blue}{\left(-1 \cdot \left(\sqrt{\frac{d}{h}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \cdot \sqrt{\frac{d}{\ell}} \]
                        7. Step-by-step derivation
                          1. *-commutativeN/A

                            \[\leadsto \left(-1 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{d}{h}}\right)}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                          2. unpow2N/A

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

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

                            \[\leadsto \color{blue}{\left(\left(-1 \cdot -1\right) \cdot \sqrt{\frac{d}{h}}\right)} \cdot \sqrt{\frac{d}{\ell}} \]
                          5. metadata-evalN/A

                            \[\leadsto \left(\color{blue}{1} \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                          6. *-lft-identityN/A

                            \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
                          7. lower-sqrt.f64N/A

                            \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
                          8. lower-/.f6450.6

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

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

                        if -8.2e-144 < h < -1.999999999999994e-310

                        1. Initial program 57.0%

                          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                        2. Add Preprocessing
                        3. Step-by-step derivation
                          1. lift-pow.f64N/A

                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

                            \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          2. unpow2N/A

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

                            \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          4. mul-1-negN/A

                            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          5. lower-*.f64N/A

                            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                          6. lower-neg.f64N/A

                            \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          7. lower-sqrt.f64N/A

                            \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                          8. lower-/.f64N/A

                            \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                          9. *-commutativeN/A

                            \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                          10. lower-*.f6472.8

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

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

                        if -1.999999999999994e-310 < h

                        1. Initial program 63.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. Add Preprocessing
                        3. Step-by-step derivation
                          1. lift-pow.f64N/A

                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        6. Step-by-step derivation
                          1. *-commutativeN/A

                            \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                          2. lower-*.f64N/A

                            \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                          3. lower-sqrt.f64N/A

                            \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                          4. lower-/.f64N/A

                            \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                          5. *-commutativeN/A

                            \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                          6. lower-*.f6443.5

                            \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                        7. Applied rewrites43.5%

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

                            \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
                          2. Step-by-step derivation
                            1. Applied rewrites46.8%

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

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

                          Alternative 13: 70.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} t_0 := \frac{M\_m \cdot \frac{D}{d}}{2}\\ t_1 := \mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{-0.5}{\ell}\right), h, 1\right)\\ \mathbf{if}\;h \leq -6.5 \cdot 10^{-180}:\\ \;\;\;\;\left(t\_1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \frac{d}{\sqrt{\ell \cdot 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
                           (let* ((t_0 (/ (* M_m (/ D d)) 2.0))
                                  (t_1 (fma (* t_0 (* t_0 (/ -0.5 l))) h 1.0)))
                             (if (<= h -6.5e-180)
                               (* (* t_1 (sqrt (/ d h))) (sqrt (/ d l)))
                               (if (<= h -2e-310)
                                 (* (- d) (sqrt (pow (* l h) -1.0)))
                                 (* t_1 (/ d (sqrt (* 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 t_0 = (M_m * (D / d)) / 2.0;
                          	double t_1 = fma((t_0 * (t_0 * (-0.5 / l))), h, 1.0);
                          	double tmp;
                          	if (h <= -6.5e-180) {
                          		tmp = (t_1 * sqrt((d / h))) * sqrt((d / l));
                          	} else if (h <= -2e-310) {
                          		tmp = -d * sqrt(pow((l * h), -1.0));
                          	} else {
                          		tmp = t_1 * (d / sqrt((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)
                          	t_0 = Float64(Float64(M_m * Float64(D / d)) / 2.0)
                          	t_1 = fma(Float64(t_0 * Float64(t_0 * Float64(-0.5 / l))), h, 1.0)
                          	tmp = 0.0
                          	if (h <= -6.5e-180)
                          		tmp = Float64(Float64(t_1 * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
                          	elseif (h <= -2e-310)
                          		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                          	else
                          		tmp = Float64(t_1 * Float64(d / sqrt(Float64(l * 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_] := Block[{t$95$0 = N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(t$95$0 * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]}, If[LessEqual[h, -6.5e-180], N[(N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(d / N[Sqrt[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}
                          t_0 := \frac{M\_m \cdot \frac{D}{d}}{2}\\
                          t_1 := \mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{-0.5}{\ell}\right), h, 1\right)\\
                          \mathbf{if}\;h \leq -6.5 \cdot 10^{-180}:\\
                          \;\;\;\;\left(t\_1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                          
                          \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
                          \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;t\_1 \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if h < -6.50000000000000013e-180

                            1. Initial program 79.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. Add Preprocessing
                            3. Applied rewrites45.3%

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

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

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

                                \[\leadsto \left(\mathsf{fma}\left(\color{blue}{\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              2. lift-*.f64N/A

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

                                \[\leadsto \left(\mathsf{fma}\left(\color{blue}{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{\frac{1}{2}}{-\ell}}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              4. lift-pow.f64N/A

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

                                \[\leadsto \left(\mathsf{fma}\left(\color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{D}{d} \cdot M}{2}\right)} \cdot \frac{\frac{1}{2}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              6. associate-*l*N/A

                                \[\leadsto \left(\mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              7. lower-*.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              8. lift-*.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{\color{blue}{\frac{D}{d} \cdot M}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              9. *-commutativeN/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              10. lower-*.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              11. lower-*.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              12. lift-*.f64N/A

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

                                \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              14. lower-*.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              15. metadata-evalN/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\color{blue}{\mathsf{neg}\left(\frac{-1}{2}\right)}}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              16. metadata-evalN/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\color{blue}{\frac{1}{2} \cdot -1}\right)}{-\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              17. lift-neg.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\frac{1}{2} \cdot -1\right)}{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              18. frac-2negN/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\frac{\frac{1}{2} \cdot -1}{\ell}}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                              19. lower-/.f64N/A

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

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

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

                            if -6.50000000000000013e-180 < h < -1.999999999999994e-310

                            1. Initial program 50.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. Add Preprocessing
                            3. Step-by-step derivation
                              1. lift-pow.f64N/A

                                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

                                \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                              2. unpow2N/A

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

                                \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                              4. mul-1-negN/A

                                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                              5. lower-*.f64N/A

                                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                              6. lower-neg.f64N/A

                                \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                              7. lower-sqrt.f64N/A

                                \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                              8. lower-/.f64N/A

                                \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                              9. *-commutativeN/A

                                \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                              10. lower-*.f6481.6

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

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

                            if -1.999999999999994e-310 < h

                            1. Initial program 63.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. Add Preprocessing
                            3. Applied rewrites59.0%

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

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

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

                                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              2. lift-*.f64N/A

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

                                \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{\frac{1}{2}}{-\ell}}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              4. lift-pow.f64N/A

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

                                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{D}{d} \cdot M}{2}\right)} \cdot \frac{\frac{1}{2}}{-\ell}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              6. associate-*l*N/A

                                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              7. lower-*.f64N/A

                                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              8. lift-*.f64N/A

                                \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\frac{D}{d} \cdot M}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              9. *-commutativeN/A

                                \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              10. lower-*.f64N/A

                                \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              11. lower-*.f64N/A

                                \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              12. lift-*.f64N/A

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

                                \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              14. lower-*.f64N/A

                                \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              15. metadata-evalN/A

                                \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\color{blue}{\mathsf{neg}\left(\frac{-1}{2}\right)}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              16. metadata-evalN/A

                                \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\color{blue}{\frac{1}{2} \cdot -1}\right)}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              17. lift-neg.f64N/A

                                \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\frac{1}{2} \cdot -1\right)}{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              18. frac-2negN/A

                                \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\frac{\frac{1}{2} \cdot -1}{\ell}}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                              19. lower-/.f64N/A

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

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

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

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

                          Alternative 14: 45.6% 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}\;d \leq 6.6 \cdot 10^{-164}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\ \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 6.6e-164)
                             (* (- d) (sqrt (pow (* l h) -1.0)))
                             (* (pow (* (sqrt l) (sqrt h)) -1.0) d)))
                          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 <= 6.6e-164) {
                          		tmp = -d * sqrt(pow((l * h), -1.0));
                          	} else {
                          		tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
                          	}
                          	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 <= 6.6d-164) then
                                  tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                              else
                                  tmp = ((sqrt(l) * sqrt(h)) ** (-1.0d0)) * d
                              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 <= 6.6e-164) {
                          		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                          	} else {
                          		tmp = Math.pow((Math.sqrt(l) * Math.sqrt(h)), -1.0) * d;
                          	}
                          	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 <= 6.6e-164:
                          		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                          	else:
                          		tmp = math.pow((math.sqrt(l) * math.sqrt(h)), -1.0) * d
                          	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 <= 6.6e-164)
                          		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                          	else
                          		tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d);
                          	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 <= 6.6e-164)
                          		tmp = -d * sqrt(((l * h) ^ -1.0));
                          	else
                          		tmp = ((sqrt(l) * sqrt(h)) ^ -1.0) * d;
                          	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, 6.6e-164], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $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 6.6 \cdot 10^{-164}:\\
                          \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if d < 6.6e-164

                            1. Initial program 69.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. Add Preprocessing
                            3. Step-by-step derivation
                              1. lift-pow.f64N/A

                                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

                                \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                              2. unpow2N/A

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

                                \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                              4. mul-1-negN/A

                                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                              5. lower-*.f64N/A

                                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                              6. lower-neg.f64N/A

                                \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                              7. lower-sqrt.f64N/A

                                \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                              8. lower-/.f64N/A

                                \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                              9. *-commutativeN/A

                                \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                              10. lower-*.f6446.4

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

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

                            if 6.6e-164 < d

                            1. Initial program 67.0%

                              \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                            2. Add Preprocessing
                            3. Step-by-step derivation
                              1. lift-pow.f64N/A

                                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

                              \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                            6. Step-by-step derivation
                              1. *-commutativeN/A

                                \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                              2. lower-*.f64N/A

                                \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                              3. lower-sqrt.f64N/A

                                \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                              4. lower-/.f64N/A

                                \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                              5. *-commutativeN/A

                                \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                              6. lower-*.f6448.9

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

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

                                \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
                              2. Step-by-step derivation
                                1. Applied rewrites53.1%

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

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

                              Alternative 15: 60.7% accurate, 3.2× 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 := \sqrt{-d}\\ t_1 := \frac{M\_m \cdot \frac{D}{d}}{2}\\ t_2 := \sqrt{\frac{d}{h}}\\ t_3 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;\ell \leq -1.06 \cdot 10^{-137}:\\ \;\;\;\;\frac{\left(1 \cdot t\_3\right) \cdot t\_0}{\sqrt{-h}}\\ \mathbf{elif}\;\ell \leq -4.6 \cdot 10^{-202}:\\ \;\;\;\;\left(\left(\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{M\_m \cdot M\_m}{\ell}\right)\right) \cdot t\_2\right) \cdot t\_3\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{\left(1 \cdot t\_2\right) \cdot t\_0}{\sqrt{-\ell}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(t\_1 \cdot \frac{-0.5}{\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot 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
                               (let* ((t_0 (sqrt (- d)))
                                      (t_1 (/ (* M_m (/ D d)) 2.0))
                                      (t_2 (sqrt (/ d h)))
                                      (t_3 (sqrt (/ d l))))
                                 (if (<= l -1.06e-137)
                                   (/ (* (* 1.0 t_3) t_0) (sqrt (- h)))
                                   (if (<= l -4.6e-202)
                                     (*
                                      (* (* (* -0.125 (/ (/ (* D D) d) d)) (* h (/ (* M_m M_m) l))) t_2)
                                      t_3)
                                     (if (<= l -1e-309)
                                       (/ (* (* 1.0 t_2) t_0) (sqrt (- l)))
                                       (* (fma (* t_1 (* t_1 (/ -0.5 l))) h 1.0) (/ d (sqrt (* 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 t_0 = sqrt(-d);
                              	double t_1 = (M_m * (D / d)) / 2.0;
                              	double t_2 = sqrt((d / h));
                              	double t_3 = sqrt((d / l));
                              	double tmp;
                              	if (l <= -1.06e-137) {
                              		tmp = ((1.0 * t_3) * t_0) / sqrt(-h);
                              	} else if (l <= -4.6e-202) {
                              		tmp = (((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * t_2) * t_3;
                              	} else if (l <= -1e-309) {
                              		tmp = ((1.0 * t_2) * t_0) / sqrt(-l);
                              	} else {
                              		tmp = fma((t_1 * (t_1 * (-0.5 / l))), h, 1.0) * (d / sqrt((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)
                              	t_0 = sqrt(Float64(-d))
                              	t_1 = Float64(Float64(M_m * Float64(D / d)) / 2.0)
                              	t_2 = sqrt(Float64(d / h))
                              	t_3 = sqrt(Float64(d / l))
                              	tmp = 0.0
                              	if (l <= -1.06e-137)
                              		tmp = Float64(Float64(Float64(1.0 * t_3) * t_0) / sqrt(Float64(-h)));
                              	elseif (l <= -4.6e-202)
                              		tmp = Float64(Float64(Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)) * Float64(h * Float64(Float64(M_m * M_m) / l))) * t_2) * t_3);
                              	elseif (l <= -1e-309)
                              		tmp = Float64(Float64(Float64(1.0 * t_2) * t_0) / sqrt(Float64(-l)));
                              	else
                              		tmp = Float64(fma(Float64(t_1 * Float64(t_1 * Float64(-0.5 / l))), h, 1.0) * Float64(d / sqrt(Float64(l * 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_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.06e-137], N[(N[(N[(1.0 * t$95$3), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4.6e-202], N[(N[(N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[l, -1e-309], N[(N[(N[(1.0 * t$95$2), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 * N[(t$95$1 * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[(d / N[Sqrt[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}
                              t_0 := \sqrt{-d}\\
                              t_1 := \frac{M\_m \cdot \frac{D}{d}}{2}\\
                              t_2 := \sqrt{\frac{d}{h}}\\
                              t_3 := \sqrt{\frac{d}{\ell}}\\
                              \mathbf{if}\;\ell \leq -1.06 \cdot 10^{-137}:\\
                              \;\;\;\;\frac{\left(1 \cdot t\_3\right) \cdot t\_0}{\sqrt{-h}}\\
                              
                              \mathbf{elif}\;\ell \leq -4.6 \cdot 10^{-202}:\\
                              \;\;\;\;\left(\left(\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{M\_m \cdot M\_m}{\ell}\right)\right) \cdot t\_2\right) \cdot t\_3\\
                              
                              \mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\
                              \;\;\;\;\frac{\left(1 \cdot t\_2\right) \cdot t\_0}{\sqrt{-\ell}}\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(t\_1 \cdot \frac{-0.5}{\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 4 regimes
                              2. if l < -1.06000000000000005e-137

                                1. Initial program 69.2%

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

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

                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                                  2. Step-by-step derivation
                                    1. lift-*.f64N/A

                                      \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1} \]
                                    2. lift-*.f64N/A

                                      \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot 1 \]
                                    3. lift-pow.f64N/A

                                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}}\right) \cdot 1 \]
                                    4. lift-/.f64N/A

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

                                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot 1 \]
                                    6. pow1/2N/A

                                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot 1 \]
                                    7. lift-sqrt.f64N/A

                                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot 1 \]
                                    8. associate-*l*N/A

                                      \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)} \]
                                    9. *-commutativeN/A

                                      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}} \]
                                    10. lift-pow.f64N/A

                                      \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}} \]
                                    11. lift-/.f64N/A

                                      \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \]
                                    12. metadata-evalN/A

                                      \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\frac{1}{2}}} \]
                                    13. unpow1/2N/A

                                      \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \color{blue}{\sqrt{\frac{d}{h}}} \]
                                    14. lift-/.f64N/A

                                      \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \sqrt{\color{blue}{\frac{d}{h}}} \]
                                    15. frac-2negN/A

                                      \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(h\right)}}} \]
                                    16. sqrt-divN/A

                                      \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \]
                                  3. Applied rewrites67.6%

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

                                  if -1.06000000000000005e-137 < l < -4.5999999999999997e-202

                                  1. Initial program 76.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. Add Preprocessing
                                  3. Applied rewrites12.1%

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \color{blue}{\frac{\frac{{D}^{2}}{d}}{d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                    7. lower-/.f64N/A

                                      \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \color{blue}{\frac{\frac{{D}^{2}}{d}}{d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                    8. lower-/.f64N/A

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

                                      \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{\color{blue}{D \cdot D}}{d}}{d}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                    10. lower-*.f64N/A

                                      \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{\color{blue}{D \cdot D}}{d}}{d}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                    11. *-commutativeN/A

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

                                      \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \color{blue}{\left(h \cdot \frac{{M}^{2}}{\ell}\right)}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                    13. lower-*.f64N/A

                                      \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \color{blue}{\left(h \cdot \frac{{M}^{2}}{\ell}\right)}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                    14. lower-/.f64N/A

                                      \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \color{blue}{\frac{{M}^{2}}{\ell}}\right)\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                    15. unpow2N/A

                                      \[\leadsto \left(\left(\left(\frac{-1}{8} \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{\color{blue}{M \cdot M}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                    16. lower-*.f6453.1

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

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

                                  if -4.5999999999999997e-202 < l < -1.000000000000002e-309

                                  1. Initial program 86.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. Add Preprocessing
                                  3. Taylor expanded in d around inf

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

                                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                                    2. Step-by-step derivation
                                      1. lift-*.f64N/A

                                        \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1} \]
                                      2. *-commutativeN/A

                                        \[\leadsto \color{blue}{1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
                                      3. lift-*.f64N/A

                                        \[\leadsto 1 \cdot \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \]
                                      4. lift-pow.f64N/A

                                        \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}}\right) \]
                                      5. lift-/.f64N/A

                                        \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \]
                                      6. metadata-evalN/A

                                        \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
                                      7. pow1/2N/A

                                        \[\leadsto 1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \]
                                      8. lift-sqrt.f64N/A

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

                                        \[\leadsto \color{blue}{\left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
                                      10. lift-sqrt.f64N/A

                                        \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
                                      11. lift-/.f64N/A

                                        \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{d}{\ell}}} \]
                                      12. frac-2negN/A

                                        \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(\ell\right)}}} \]
                                      13. sqrt-divN/A

                                        \[\leadsto \left(1 \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}}} \]
                                    3. Applied rewrites50.1%

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

                                    if -1.000000000000002e-309 < l

                                    1. Initial program 63.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. Add Preprocessing
                                    3. Applied rewrites59.0%

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

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

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

                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      2. lift-*.f64N/A

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

                                        \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{\frac{1}{2}}{-\ell}}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      4. lift-pow.f64N/A

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

                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{D}{d} \cdot M}{2}\right)} \cdot \frac{\frac{1}{2}}{-\ell}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      6. associate-*l*N/A

                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      7. lower-*.f64N/A

                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      8. lift-*.f64N/A

                                        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\frac{D}{d} \cdot M}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      9. *-commutativeN/A

                                        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      10. lower-*.f64N/A

                                        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      11. lower-*.f64N/A

                                        \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      12. lift-*.f64N/A

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

                                        \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      14. lower-*.f64N/A

                                        \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      15. metadata-evalN/A

                                        \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\color{blue}{\mathsf{neg}\left(\frac{-1}{2}\right)}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      16. metadata-evalN/A

                                        \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\color{blue}{\frac{1}{2} \cdot -1}\right)}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      17. lift-neg.f64N/A

                                        \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\frac{1}{2} \cdot -1\right)}{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      18. frac-2negN/A

                                        \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\frac{\frac{1}{2} \cdot -1}{\ell}}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                      19. lower-/.f64N/A

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

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

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

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

                                  Alternative 16: 42.4% accurate, 3.2× 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 := \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{if}\;d \leq -6.2 \cdot 10^{-259}:\\ \;\;\;\;\left(-d\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot d\\ \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 (sqrt (pow (* l h) -1.0))))
                                     (if (<= d -6.2e-259) (* (- d) t_0) (* t_0 d))))
                                  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 = sqrt(pow((l * h), -1.0));
                                  	double tmp;
                                  	if (d <= -6.2e-259) {
                                  		tmp = -d * t_0;
                                  	} else {
                                  		tmp = t_0 * d;
                                  	}
                                  	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 = sqrt(((l * h) ** (-1.0d0)))
                                      if (d <= (-6.2d-259)) then
                                          tmp = -d * t_0
                                      else
                                          tmp = t_0 * d
                                      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.sqrt(Math.pow((l * h), -1.0));
                                  	double tmp;
                                  	if (d <= -6.2e-259) {
                                  		tmp = -d * t_0;
                                  	} else {
                                  		tmp = t_0 * d;
                                  	}
                                  	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.sqrt(math.pow((l * h), -1.0))
                                  	tmp = 0
                                  	if d <= -6.2e-259:
                                  		tmp = -d * t_0
                                  	else:
                                  		tmp = t_0 * d
                                  	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 = sqrt((Float64(l * h) ^ -1.0))
                                  	tmp = 0.0
                                  	if (d <= -6.2e-259)
                                  		tmp = Float64(Float64(-d) * t_0);
                                  	else
                                  		tmp = Float64(t_0 * d);
                                  	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 = sqrt(((l * h) ^ -1.0));
                                  	tmp = 0.0;
                                  	if (d <= -6.2e-259)
                                  		tmp = -d * t_0;
                                  	else
                                  		tmp = t_0 * d;
                                  	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[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -6.2e-259], N[((-d) * t$95$0), $MachinePrecision], N[(t$95$0 * d), $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 := \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                                  \mathbf{if}\;d \leq -6.2 \cdot 10^{-259}:\\
                                  \;\;\;\;\left(-d\right) \cdot t\_0\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;t\_0 \cdot d\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if d < -6.1999999999999995e-259

                                    1. Initial program 73.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
                                    3. Step-by-step derivation
                                      1. lift-pow.f64N/A

                                        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

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

                                        \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                      2. unpow2N/A

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

                                        \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                      4. mul-1-negN/A

                                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                      5. lower-*.f64N/A

                                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                      6. lower-neg.f64N/A

                                        \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                      7. lower-sqrt.f64N/A

                                        \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                      8. lower-/.f64N/A

                                        \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                      9. *-commutativeN/A

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

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

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

                                    if -6.1999999999999995e-259 < d

                                    1. Initial program 64.2%

                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                    2. Add Preprocessing
                                    3. Step-by-step derivation
                                      1. lift-pow.f64N/A

                                        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

                                      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                    6. Step-by-step derivation
                                      1. *-commutativeN/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                      2. lower-*.f64N/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                      3. lower-sqrt.f64N/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                      4. lower-/.f64N/A

                                        \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                      5. *-commutativeN/A

                                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                      6. lower-*.f6444.3

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

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

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

                                  Alternative 17: 64.1% accurate, 3.3× 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 := \frac{M\_m \cdot \frac{D}{d}}{2}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;d \leq -8 \cdot 10^{-25}:\\ \;\;\;\;\frac{\left(1 \cdot t\_1\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\ \mathbf{elif}\;d \leq -1.15 \cdot 10^{-280}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{\frac{M\_m \cdot M\_m}{d}}{d}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{-0.5}{\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot 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
                                   (let* ((t_0 (/ (* M_m (/ D d)) 2.0)) (t_1 (sqrt (/ d l))))
                                     (if (<= d -8e-25)
                                       (/ (* (* 1.0 t_1) (sqrt (- d))) (sqrt (- h)))
                                       (if (<= d -1.15e-280)
                                         (*
                                          (*
                                           (fma (/ (* (* 0.125 (* D D)) (/ (/ (* M_m M_m) d) d)) (- l)) h 1.0)
                                           (sqrt (/ d h)))
                                          t_1)
                                         (* (fma (* t_0 (* t_0 (/ -0.5 l))) h 1.0) (/ d (sqrt (* 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 t_0 = (M_m * (D / d)) / 2.0;
                                  	double t_1 = sqrt((d / l));
                                  	double tmp;
                                  	if (d <= -8e-25) {
                                  		tmp = ((1.0 * t_1) * sqrt(-d)) / sqrt(-h);
                                  	} else if (d <= -1.15e-280) {
                                  		tmp = (fma((((0.125 * (D * D)) * (((M_m * M_m) / d) / d)) / -l), h, 1.0) * sqrt((d / h))) * t_1;
                                  	} else {
                                  		tmp = fma((t_0 * (t_0 * (-0.5 / l))), h, 1.0) * (d / sqrt((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)
                                  	t_0 = Float64(Float64(M_m * Float64(D / d)) / 2.0)
                                  	t_1 = sqrt(Float64(d / l))
                                  	tmp = 0.0
                                  	if (d <= -8e-25)
                                  		tmp = Float64(Float64(Float64(1.0 * t_1) * sqrt(Float64(-d))) / sqrt(Float64(-h)));
                                  	elseif (d <= -1.15e-280)
                                  		tmp = Float64(Float64(fma(Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(Float64(M_m * M_m) / d) / d)) / Float64(-l)), h, 1.0) * sqrt(Float64(d / h))) * t_1);
                                  	else
                                  		tmp = Float64(fma(Float64(t_0 * Float64(t_0 * Float64(-0.5 / l))), h, 1.0) * Float64(d / sqrt(Float64(l * 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_] := Block[{t$95$0 = N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -8e-25], N[(N[(N[(1.0 * t$95$1), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.15e-280], N[(N[(N[(N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(t$95$0 * N[(t$95$0 * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[(d / N[Sqrt[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}
                                  t_0 := \frac{M\_m \cdot \frac{D}{d}}{2}\\
                                  t_1 := \sqrt{\frac{d}{\ell}}\\
                                  \mathbf{if}\;d \leq -8 \cdot 10^{-25}:\\
                                  \;\;\;\;\frac{\left(1 \cdot t\_1\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
                                  
                                  \mathbf{elif}\;d \leq -1.15 \cdot 10^{-280}:\\
                                  \;\;\;\;\left(\mathsf{fma}\left(\frac{\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{\frac{M\_m \cdot M\_m}{d}}{d}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_1\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{-0.5}{\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 3 regimes
                                  2. if d < -8.00000000000000031e-25

                                    1. Initial program 77.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. Add Preprocessing
                                    3. Taylor expanded in d around inf

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

                                        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                                      2. Step-by-step derivation
                                        1. lift-*.f64N/A

                                          \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1} \]
                                        2. lift-*.f64N/A

                                          \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot 1 \]
                                        3. lift-pow.f64N/A

                                          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}}\right) \cdot 1 \]
                                        4. lift-/.f64N/A

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

                                          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot 1 \]
                                        6. pow1/2N/A

                                          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot 1 \]
                                        7. lift-sqrt.f64N/A

                                          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot 1 \]
                                        8. associate-*l*N/A

                                          \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)} \]
                                        9. *-commutativeN/A

                                          \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}} \]
                                        10. lift-pow.f64N/A

                                          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}} \]
                                        11. lift-/.f64N/A

                                          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \]
                                        12. metadata-evalN/A

                                          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\frac{1}{2}}} \]
                                        13. unpow1/2N/A

                                          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \color{blue}{\sqrt{\frac{d}{h}}} \]
                                        14. lift-/.f64N/A

                                          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \sqrt{\color{blue}{\frac{d}{h}}} \]
                                        15. frac-2negN/A

                                          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(h\right)}}} \]
                                        16. sqrt-divN/A

                                          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \]
                                      3. Applied rewrites72.7%

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

                                      if -8.00000000000000031e-25 < d < -1.15e-280

                                      1. Initial program 67.2%

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

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

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

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

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

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

                                          \[\leadsto \left(\mathsf{fma}\left(\frac{\color{blue}{\left(\frac{1}{8} \cdot {D}^{2}\right) \cdot \frac{{M}^{2}}{{d}^{2}}}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                        3. lower-*.f64N/A

                                          \[\leadsto \left(\mathsf{fma}\left(\frac{\color{blue}{\left(\frac{1}{8} \cdot {D}^{2}\right) \cdot \frac{{M}^{2}}{{d}^{2}}}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                        4. lower-*.f64N/A

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

                                          \[\leadsto \left(\mathsf{fma}\left(\frac{\left(\frac{1}{8} \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{{M}^{2}}{{d}^{2}}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                        6. lower-*.f64N/A

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

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

                                          \[\leadsto \left(\mathsf{fma}\left(\frac{\left(\frac{1}{8} \cdot \left(D \cdot D\right)\right) \cdot \color{blue}{\frac{\frac{{M}^{2}}{d}}{d}}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                        9. lower-/.f64N/A

                                          \[\leadsto \left(\mathsf{fma}\left(\frac{\left(\frac{1}{8} \cdot \left(D \cdot D\right)\right) \cdot \color{blue}{\frac{\frac{{M}^{2}}{d}}{d}}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                        10. lower-/.f64N/A

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

                                          \[\leadsto \left(\mathsf{fma}\left(\frac{\left(\frac{1}{8} \cdot \left(D \cdot D\right)\right) \cdot \frac{\frac{\color{blue}{M \cdot M}}{d}}{d}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                        12. lower-*.f6450.0

                                          \[\leadsto \left(\mathsf{fma}\left(\frac{\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{\frac{\color{blue}{M \cdot M}}{d}}{d}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}} \]
                                      8. Applied rewrites50.0%

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

                                      if -1.15e-280 < d

                                      1. Initial program 63.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. Add Preprocessing
                                      3. Applied rewrites58.8%

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

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

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

                                          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{1}{2}}{-\ell}}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        2. lift-*.f64N/A

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

                                          \[\leadsto \mathsf{fma}\left(\color{blue}{{\left(\frac{\frac{D}{d} \cdot M}{2}\right)}^{2} \cdot \frac{\frac{1}{2}}{-\ell}}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        4. lift-pow.f64N/A

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

                                          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{D}{d} \cdot M}{2}\right)} \cdot \frac{\frac{1}{2}}{-\ell}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        6. associate-*l*N/A

                                          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        7. lower-*.f64N/A

                                          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\frac{D}{d} \cdot M}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        8. lift-*.f64N/A

                                          \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\frac{D}{d} \cdot M}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        9. *-commutativeN/A

                                          \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        10. lower-*.f64N/A

                                          \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        11. lower-*.f64N/A

                                          \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\left(\frac{\frac{D}{d} \cdot M}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right)}, h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        12. lift-*.f64N/A

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

                                          \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        14. lower-*.f64N/A

                                          \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{\color{blue}{M \cdot \frac{D}{d}}}{2} \cdot \frac{\frac{1}{2}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        15. metadata-evalN/A

                                          \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\color{blue}{\mathsf{neg}\left(\frac{-1}{2}\right)}}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        16. metadata-evalN/A

                                          \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\color{blue}{\frac{1}{2} \cdot -1}\right)}{-\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        17. lift-neg.f64N/A

                                          \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \frac{\mathsf{neg}\left(\frac{1}{2} \cdot -1\right)}{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        18. frac-2negN/A

                                          \[\leadsto \mathsf{fma}\left(\frac{M \cdot \frac{D}{d}}{2} \cdot \left(\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\frac{\frac{1}{2} \cdot -1}{\ell}}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}} \]
                                        19. lower-/.f64N/A

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

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

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

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

                                    Alternative 18: 26.5% accurate, 3.4× speedup?

                                    \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \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 (* (sqrt (pow (* l h) -1.0)) d))
                                    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 sqrt(pow((l * h), -1.0)) * d;
                                    }
                                    
                                    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 = sqrt(((l * h) ** (-1.0d0))) * d
                                    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 Math.sqrt(Math.pow((l * h), -1.0)) * d;
                                    }
                                    
                                    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 math.sqrt(math.pow((l * h), -1.0)) * d
                                    
                                    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(sqrt((Float64(l * h) ^ -1.0)) * d)
                                    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 = sqrt(((l * h) ^ -1.0)) * d;
                                    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[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
                                    
                                    \begin{array}{l}
                                    M_m = \left|M\right|
                                    \\
                                    [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                    \\
                                    \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d
                                    \end{array}
                                    
                                    Derivation
                                    1. Initial program 68.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. Add Preprocessing
                                    3. Step-by-step derivation
                                      1. lift-pow.f64N/A

                                        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

                                      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                    6. Step-by-step derivation
                                      1. *-commutativeN/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                      2. lower-*.f64N/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                      3. lower-sqrt.f64N/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                      4. lower-/.f64N/A

                                        \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                      5. *-commutativeN/A

                                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                      6. lower-*.f6427.8

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

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

                                      \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
                                    9. Add Preprocessing

                                    Alternative 19: 26.5% accurate, 15.3× speedup?

                                    \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \frac{d}{\sqrt{h \cdot \ell}} \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 (* h 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) {
                                    	return d / sqrt((h * l));
                                    }
                                    
                                    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((h * l))
                                    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((h * l));
                                    }
                                    
                                    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((h * l))
                                    
                                    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(h * l)))
                                    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((h * l));
                                    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[(h * 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])\\
                                    \\
                                    \frac{d}{\sqrt{h \cdot \ell}}
                                    \end{array}
                                    
                                    Derivation
                                    1. Initial program 68.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. Add Preprocessing
                                    3. Step-by-step derivation
                                      1. lift-pow.f64N/A

                                        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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. lift-/.f64N/A

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

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

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

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

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

                                      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                    6. Step-by-step derivation
                                      1. *-commutativeN/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                      2. lower-*.f64N/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                      3. lower-sqrt.f64N/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                      4. lower-/.f64N/A

                                        \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                      5. *-commutativeN/A

                                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                      6. lower-*.f6427.8

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

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

                                        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
                                      2. Step-by-step derivation
                                        1. Applied rewrites27.1%

                                          \[\leadsto \frac{d}{\color{blue}{\sqrt{h \cdot \ell}}} \]
                                        2. Add Preprocessing

                                        Reproduce

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