Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.3% → 77.8%
Time: 15.1s
Alternatives: 14
Speedup: 2.2×

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 14 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.3% 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: 77.8% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 69.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 rewrites80.9%

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < h

    1. Initial program 65.9%

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

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

Alternative 2: 77.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \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 \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+239}:\\ \;\;\;\;\left(\mathsf{fma}\left(h, \frac{-0.125 \cdot {\left(\frac{d}{M \cdot D}\right)}^{-2}}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \left(D \cdot D\right)\right) \cdot \left(\left(-M\right) \cdot \frac{M}{d}\right), 0.125, \left(-d\right) \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \end{array} \end{array} \]
(FPCore (d h l 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 D) (* 2.0 d)) 2.0)) (/ h l))))))
   (if (<= t_0 2e+239)
     (*
      (* (fma h (/ (* -0.125 (pow (/ d (* M D)) -2.0)) l) 1.0) (sqrt (/ d h)))
      (sqrt (/ d l)))
     (if (<= t_0 INFINITY)
       (fabs (/ d (sqrt (* l h))))
       (/
        (fma
         (* (* (sqrt (pow (/ h l) 3.0)) (* D D)) (* (- M) (/ M d)))
         0.125
         (* (- d) (sqrt (/ h l))))
        h)))))
double code(double d, double h, double l, double 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 * D) / (2.0 * d)), 2.0)) * (h / l)));
	double tmp;
	if (t_0 <= 2e+239) {
		tmp = (fma(h, ((-0.125 * pow((d / (M * D)), -2.0)) / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
	} else if (t_0 <= ((double) INFINITY)) {
		tmp = fabs((d / sqrt((l * h))));
	} else {
		tmp = fma(((sqrt(pow((h / l), 3.0)) * (D * D)) * (-M * (M / d))), 0.125, (-d * sqrt((h / l)))) / h;
	}
	return tmp;
}
function code(d, h, l, 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 * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	tmp = 0.0
	if (t_0 <= 2e+239)
		tmp = Float64(Float64(fma(h, Float64(Float64(-0.125 * (Float64(d / Float64(M * D)) ^ -2.0)) / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
	elseif (t_0 <= Inf)
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	else
		tmp = Float64(fma(Float64(Float64(sqrt((Float64(h / l) ^ 3.0)) * Float64(D * D)) * Float64(Float64(-M) * Float64(M / d))), 0.125, Float64(Float64(-d) * sqrt(Float64(h / l)))) / h);
	end
	return tmp
end
code[d_, h_, l_, 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 * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+239], N[(N[(N[(h * N[(N[(-0.125 * N[Power[N[(d / N[(M * D), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[((-M) * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]
\begin{array}{l}

\\
\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 \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+239}:\\
\;\;\;\;\left(\mathsf{fma}\left(h, \frac{-0.125 \cdot {\left(\frac{d}{M \cdot D}\right)}^{-2}}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

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


\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)))) < 1.99999999999999998e239

    1. Initial program 89.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. 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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.99999999999999998e239 < (*.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 42.9%

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. 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-*.f6445.4

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. Applied rewrites45.4%

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

          \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]

        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. Taylor expanded in h around 0

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

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

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

            \[\leadsto \frac{\mathsf{fma}\left(D \cdot \left(\frac{D}{d} \cdot \left(-0.125 \cdot \left(M \cdot M\right)\right)\right), \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h} \]
          2. Taylor expanded in l around -inf

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

            \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \left(D \cdot D\right)\right) \cdot \left(\left(-M\right) \cdot \frac{M}{d}\right), 0.125, \left(-d\right) \cdot \sqrt{\frac{h}{\ell}}\right)}{h} \]
        7. Recombined 3 regimes into one program.
        8. Final simplification81.0%

          \[\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^{+239}:\\ \;\;\;\;\left(\mathsf{fma}\left(h, \frac{-0.125 \cdot {\left(\frac{d}{M \cdot D}\right)}^{-2}}{\ell}, 1\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:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \left(D \cdot D\right)\right) \cdot \left(\left(-M\right) \cdot \frac{M}{d}\right), 0.125, \left(-d\right) \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 3: 68.6% accurate, 0.3× speedup?

        \[\begin{array}{l} \\ \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 \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 -1 \cdot 10^{-233}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{h}{\ell \cdot d}, \left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot \frac{D \cdot D}{d}, 1\right) \cdot t\_1\right) \cdot t\_2\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+239}:\\ \;\;\;\;t\_1 \cdot t\_2\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \end{array} \]
        (FPCore (d h l 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 D) (* 2.0 d)) 2.0)) (/ h l)))))
                (t_1 (sqrt (/ d h)))
                (t_2 (sqrt (/ d l))))
           (if (<= t_0 -1e-233)
             (*
              (* (fma (/ h (* l d)) (* (* -0.125 (* M M)) (/ (* D D) d)) 1.0) t_1)
              t_2)
             (if (<= t_0 2e+239) (* t_1 t_2) (fabs (/ d (sqrt (* l h))))))))
        double code(double d, double h, double l, double 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 * 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 <= -1e-233) {
        		tmp = (fma((h / (l * d)), ((-0.125 * (M * M)) * ((D * D) / d)), 1.0) * t_1) * t_2;
        	} else if (t_0 <= 2e+239) {
        		tmp = t_1 * t_2;
        	} else {
        		tmp = fabs((d / sqrt((l * h))));
        	}
        	return tmp;
        }
        
        function code(d, h, l, 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 * 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 <= -1e-233)
        		tmp = Float64(Float64(fma(Float64(h / Float64(l * d)), Float64(Float64(-0.125 * Float64(M * M)) * Float64(Float64(D * D) / d)), 1.0) * t_1) * t_2);
        	elseif (t_0 <= 2e+239)
        		tmp = Float64(t_1 * t_2);
        	else
        		tmp = abs(Float64(d / sqrt(Float64(l * h))));
        	end
        	return tmp
        end
        
        code[d_, h_, l_, 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 * 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, -1e-233], N[(N[(N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 2e+239], N[(t$95$1 * t$95$2), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
        
        \begin{array}{l}
        
        \\
        \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 \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 -1 \cdot 10^{-233}:\\
        \;\;\;\;\left(\mathsf{fma}\left(\frac{h}{\ell \cdot d}, \left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot \frac{D \cdot D}{d}, 1\right) \cdot t\_1\right) \cdot t\_2\\
        
        \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+239}:\\
        \;\;\;\;t\_1 \cdot t\_2\\
        
        \mathbf{else}:\\
        \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
        
        
        \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)))) < -9.99999999999999958e-234

          1. Initial program 87.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-*.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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{\left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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. associate-*r*N/A

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

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

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

            \[\leadsto \left(\color{blue}{\left(1 + \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}} \]
          6. Step-by-step derivation
            1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -9.99999999999999958e-234 < (*.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.99999999999999998e239

          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. 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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{\left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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. associate-*r*N/A

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

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

            \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
          5. 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}} \]
          6. 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-/.f6490.5

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

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

          if 1.99999999999999998e239 < (*.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 17.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
          4. 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-*.f6429.7

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

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

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

                \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
            3. Recombined 3 regimes into one program.
            4. Final simplification69.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 -1 \cdot 10^{-233}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{h}{\ell \cdot d}, \left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot \frac{D \cdot D}{d}, 1\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 2 \cdot 10^{+239}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
            5. Add Preprocessing

            Alternative 4: 68.6% accurate, 0.3× speedup?

            \[\begin{array}{l} \\ \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 \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 -1 \cdot 10^{-233}:\\ \;\;\;\;\left(\left(\frac{h}{\ell \cdot d} \cdot \left(\left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot \frac{D \cdot D}{d}\right)\right) \cdot t\_1\right) \cdot t\_2\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+239}:\\ \;\;\;\;t\_1 \cdot t\_2\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \end{array} \]
            (FPCore (d h l 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 D) (* 2.0 d)) 2.0)) (/ h l)))))
                    (t_1 (sqrt (/ d h)))
                    (t_2 (sqrt (/ d l))))
               (if (<= t_0 -1e-233)
                 (* (* (* (/ h (* l d)) (* (* -0.125 (* M M)) (/ (* D D) d))) t_1) t_2)
                 (if (<= t_0 2e+239) (* t_1 t_2) (fabs (/ d (sqrt (* l h))))))))
            double code(double d, double h, double l, double 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 * 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 <= -1e-233) {
            		tmp = (((h / (l * d)) * ((-0.125 * (M * M)) * ((D * D) / d))) * t_1) * t_2;
            	} else if (t_0 <= 2e+239) {
            		tmp = t_1 * t_2;
            	} else {
            		tmp = fabs((d / sqrt((l * h))));
            	}
            	return tmp;
            }
            
            real(8) function code(d, h, l, m, d_1)
                real(8), intent (in) :: d
                real(8), intent (in) :: h
                real(8), intent (in) :: l
                real(8), intent (in) :: m
                real(8), intent (in) :: d_1
                real(8) :: t_0
                real(8) :: t_1
                real(8) :: t_2
                real(8) :: tmp
                t_0 = (((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
                t_1 = sqrt((d / h))
                t_2 = sqrt((d / l))
                if (t_0 <= (-1d-233)) then
                    tmp = (((h / (l * d)) * (((-0.125d0) * (m * m)) * ((d_1 * d_1) / d))) * t_1) * t_2
                else if (t_0 <= 2d+239) then
                    tmp = t_1 * t_2
                else
                    tmp = abs((d / sqrt((l * h))))
                end if
                code = tmp
            end function
            
            public static double code(double d, double h, double l, double M, double D) {
            	double t_0 = (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 * D) / (2.0 * d)), 2.0)) * (h / l)));
            	double t_1 = Math.sqrt((d / h));
            	double t_2 = Math.sqrt((d / l));
            	double tmp;
            	if (t_0 <= -1e-233) {
            		tmp = (((h / (l * d)) * ((-0.125 * (M * M)) * ((D * D) / d))) * t_1) * t_2;
            	} else if (t_0 <= 2e+239) {
            		tmp = t_1 * t_2;
            	} else {
            		tmp = Math.abs((d / Math.sqrt((l * h))));
            	}
            	return tmp;
            }
            
            def code(d, h, l, M, D):
            	t_0 = (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 * D) / (2.0 * d)), 2.0)) * (h / l)))
            	t_1 = math.sqrt((d / h))
            	t_2 = math.sqrt((d / l))
            	tmp = 0
            	if t_0 <= -1e-233:
            		tmp = (((h / (l * d)) * ((-0.125 * (M * M)) * ((D * D) / d))) * t_1) * t_2
            	elif t_0 <= 2e+239:
            		tmp = t_1 * t_2
            	else:
            		tmp = math.fabs((d / math.sqrt((l * h))))
            	return tmp
            
            function code(d, h, l, 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 * 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 <= -1e-233)
            		tmp = Float64(Float64(Float64(Float64(h / Float64(l * d)) * Float64(Float64(-0.125 * Float64(M * M)) * Float64(Float64(D * D) / d))) * t_1) * t_2);
            	elseif (t_0 <= 2e+239)
            		tmp = Float64(t_1 * t_2);
            	else
            		tmp = abs(Float64(d / sqrt(Float64(l * h))));
            	end
            	return tmp
            end
            
            function tmp_2 = code(d, h, l, M, D)
            	t_0 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
            	t_1 = sqrt((d / h));
            	t_2 = sqrt((d / l));
            	tmp = 0.0;
            	if (t_0 <= -1e-233)
            		tmp = (((h / (l * d)) * ((-0.125 * (M * M)) * ((D * D) / d))) * t_1) * t_2;
            	elseif (t_0 <= 2e+239)
            		tmp = t_1 * t_2;
            	else
            		tmp = abs((d / sqrt((l * h))));
            	end
            	tmp_2 = tmp;
            end
            
            code[d_, h_, l_, 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 * 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, -1e-233], N[(N[(N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 2e+239], N[(t$95$1 * t$95$2), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
            
            \begin{array}{l}
            
            \\
            \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 \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 -1 \cdot 10^{-233}:\\
            \;\;\;\;\left(\left(\frac{h}{\ell \cdot d} \cdot \left(\left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot \frac{D \cdot D}{d}\right)\right) \cdot t\_1\right) \cdot t\_2\\
            
            \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+239}:\\
            \;\;\;\;t\_1 \cdot t\_2\\
            
            \mathbf{else}:\\
            \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
            
            
            \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)))) < -9.99999999999999958e-234

              1. Initial program 87.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-*.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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)} \]
                2. *-commutativeN/A

                  \[\leadsto \color{blue}{\left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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. associate-*r*N/A

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

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

                \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
              5. 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}} \]
              6. Step-by-step derivation
                1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if -9.99999999999999958e-234 < (*.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.99999999999999998e239

              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. 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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)} \]
                2. *-commutativeN/A

                  \[\leadsto \color{blue}{\left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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. associate-*r*N/A

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

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

                \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
              5. 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}} \]
              6. 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-/.f6490.5

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

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

              if 1.99999999999999998e239 < (*.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 17.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
              4. 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-*.f6429.7

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

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

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

                    \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                3. Recombined 3 regimes into one program.
                4. Final simplification69.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 -1 \cdot 10^{-233}:\\ \;\;\;\;\left(\left(\frac{h}{\ell \cdot d} \cdot \left(\left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot \frac{D \cdot D}{d}\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 2 \cdot 10^{+239}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                5. Add Preprocessing

                Alternative 5: 54.6% accurate, 0.3× speedup?

                \[\begin{array}{l} \\ \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 \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-233}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+239}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \end{array} \]
                (FPCore (d h l 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 D) (* 2.0 d)) 2.0)) (/ h l))))))
                   (if (<= t_0 -1e-233)
                     (/ (* (- d) (sqrt (/ h l))) h)
                     (if (<= t_0 2e+239)
                       (* (sqrt (/ d h)) (sqrt (/ d l)))
                       (fabs (/ d (sqrt (* l h))))))))
                double code(double d, double h, double l, double 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 * D) / (2.0 * d)), 2.0)) * (h / l)));
                	double tmp;
                	if (t_0 <= -1e-233) {
                		tmp = (-d * sqrt((h / l))) / h;
                	} else if (t_0 <= 2e+239) {
                		tmp = sqrt((d / h)) * sqrt((d / l));
                	} else {
                		tmp = fabs((d / sqrt((l * h))));
                	}
                	return tmp;
                }
                
                real(8) function code(d, h, l, m, d_1)
                    real(8), intent (in) :: d
                    real(8), intent (in) :: h
                    real(8), intent (in) :: l
                    real(8), intent (in) :: m
                    real(8), intent (in) :: d_1
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = (((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
                    if (t_0 <= (-1d-233)) then
                        tmp = (-d * sqrt((h / l))) / h
                    else if (t_0 <= 2d+239) then
                        tmp = sqrt((d / h)) * sqrt((d / l))
                    else
                        tmp = abs((d / sqrt((l * h))))
                    end if
                    code = tmp
                end function
                
                public static double code(double d, double h, double l, double M, double D) {
                	double t_0 = (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 * D) / (2.0 * d)), 2.0)) * (h / l)));
                	double tmp;
                	if (t_0 <= -1e-233) {
                		tmp = (-d * Math.sqrt((h / l))) / h;
                	} else if (t_0 <= 2e+239) {
                		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
                	} else {
                		tmp = Math.abs((d / Math.sqrt((l * h))));
                	}
                	return tmp;
                }
                
                def code(d, h, l, M, D):
                	t_0 = (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 * D) / (2.0 * d)), 2.0)) * (h / l)))
                	tmp = 0
                	if t_0 <= -1e-233:
                		tmp = (-d * math.sqrt((h / l))) / h
                	elif t_0 <= 2e+239:
                		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
                	else:
                		tmp = math.fabs((d / math.sqrt((l * h))))
                	return tmp
                
                function code(d, h, l, 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 * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                	tmp = 0.0
                	if (t_0 <= -1e-233)
                		tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h);
                	elseif (t_0 <= 2e+239)
                		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
                	else
                		tmp = abs(Float64(d / sqrt(Float64(l * h))));
                	end
                	return tmp
                end
                
                function tmp_2 = code(d, h, l, M, D)
                	t_0 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
                	tmp = 0.0;
                	if (t_0 <= -1e-233)
                		tmp = (-d * sqrt((h / l))) / h;
                	elseif (t_0 <= 2e+239)
                		tmp = sqrt((d / h)) * sqrt((d / l));
                	else
                		tmp = abs((d / sqrt((l * h))));
                	end
                	tmp_2 = tmp;
                end
                
                code[d_, h_, l_, 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 * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-233], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$0, 2e+239], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
                
                \begin{array}{l}
                
                \\
                \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 \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-233}:\\
                \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                
                \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+239}:\\
                \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
                
                \mathbf{else}:\\
                \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
                
                
                \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)))) < -9.99999999999999958e-234

                  1. Initial program 87.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 h around 0

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

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

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

                    \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                  7. Step-by-step derivation
                    1. Applied rewrites22.2%

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

                    if -9.99999999999999958e-234 < (*.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.99999999999999998e239

                    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. 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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)} \]
                      2. *-commutativeN/A

                        \[\leadsto \color{blue}{\left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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. associate-*r*N/A

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

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

                      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}} \]
                    5. 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}} \]
                    6. 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-/.f6490.5

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

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

                    if 1.99999999999999998e239 < (*.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 17.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                    4. 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-*.f6429.7

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

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

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

                          \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                      3. Recombined 3 regimes into one program.
                      4. Final simplification52.7%

                        \[\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 -1 \cdot 10^{-233}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \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 2 \cdot 10^{+239}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 6: 51.2% accurate, 0.3× speedup?

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

                        1. Initial program 87.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 h around 0

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

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

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

                          \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                        7. Step-by-step derivation
                          1. Applied rewrites22.2%

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

                          if -9.99999999999999958e-234 < (*.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.99999999999999998e239

                          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. Taylor expanded in h around 0

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

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

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

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

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

                            if 1.99999999999999998e239 < (*.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 17.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                            4. 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-*.f6429.7

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

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

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

                                  \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                              3. Recombined 3 regimes into one program.
                              4. Final simplification51.3%

                                \[\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 -1 \cdot 10^{-233}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \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 2 \cdot 10^{+239}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                              5. Add Preprocessing

                              Alternative 7: 47.7% accurate, 0.3× speedup?

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

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

                                  \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                4. 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-*.f6416.6

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

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

                                if -0.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.99999999999999998e239

                                1. Initial program 98.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 h around 0

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

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

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

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

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

                                  if 1.99999999999999998e239 < (*.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 17.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                  4. 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-*.f6429.7

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

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

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

                                        \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                    3. Recombined 3 regimes into one program.
                                    4. Final simplification46.7%

                                      \[\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 0:\\ \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\ \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 2 \cdot 10^{+239}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                    5. Add Preprocessing

                                    Alternative 8: 76.1% accurate, 0.5× speedup?

                                    \[\begin{array}{l} \\ \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^{+239}:\\ \;\;\;\;\left(\mathsf{fma}\left(h, \frac{-0.125 \cdot {\left(\frac{d}{M \cdot D}\right)}^{-2}}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \end{array} \]
                                    (FPCore (d h l 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 D) (* 2.0 d)) 2.0)) (/ h l))))
                                          2e+239)
                                       (*
                                        (* (fma h (/ (* -0.125 (pow (/ d (* M D)) -2.0)) l) 1.0) (sqrt (/ d h)))
                                        (sqrt (/ d l)))
                                       (fabs (/ d (sqrt (* l h))))))
                                    double code(double d, double h, double l, double 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 * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 2e+239) {
                                    		tmp = (fma(h, ((-0.125 * pow((d / (M * D)), -2.0)) / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
                                    	} else {
                                    		tmp = fabs((d / sqrt((l * h))));
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(d, h, l, 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 * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 2e+239)
                                    		tmp = Float64(Float64(fma(h, Float64(Float64(-0.125 * (Float64(d / Float64(M * D)) ^ -2.0)) / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
                                    	else
                                    		tmp = abs(Float64(d / sqrt(Float64(l * h))));
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[d_, h_, l_, 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 * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+239], N[(N[(N[(h * N[(N[(-0.125 * N[Power[N[(d / N[(M * D), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \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^{+239}:\\
                                    \;\;\;\;\left(\mathsf{fma}\left(h, \frac{-0.125 \cdot {\left(\frac{d}{M \cdot D}\right)}^{-2}}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
                                    
                                    
                                    \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)))) < 1.99999999999999998e239

                                      1. Initial program 89.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. 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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)} \]
                                        2. *-commutativeN/A

                                          \[\leadsto \color{blue}{\left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      if 1.99999999999999998e239 < (*.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 17.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                      4. 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-*.f6429.7

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

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

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

                                            \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                        3. Recombined 2 regimes into one program.
                                        4. Final simplification79.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^{+239}:\\ \;\;\;\;\left(\mathsf{fma}\left(h, \frac{-0.125 \cdot {\left(\frac{d}{M \cdot D}\right)}^{-2}}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                        5. Add Preprocessing

                                        Alternative 9: 76.9% accurate, 0.5× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(D \cdot \frac{0.5}{d}\right) \cdot M\\ \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^{+239}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_0, t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \end{array} \]
                                        (FPCore (d h l M D)
                                         :precision binary64
                                         (let* ((t_0 (* (* D (/ 0.5 d)) M)))
                                           (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 D) (* 2.0 d)) 2.0)) (/ h l))))
                                                2e+239)
                                             (*
                                              (* (fma (* (* (/ h l) -0.5) t_0) t_0 1.0) (sqrt (/ d h)))
                                              (sqrt (/ d l)))
                                             (fabs (/ d (sqrt (* l h)))))))
                                        double code(double d, double h, double l, double M, double D) {
                                        	double t_0 = (D * (0.5 / d)) * M;
                                        	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 * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 2e+239) {
                                        		tmp = (fma((((h / l) * -0.5) * t_0), t_0, 1.0) * sqrt((d / h))) * sqrt((d / l));
                                        	} else {
                                        		tmp = fabs((d / sqrt((l * h))));
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(d, h, l, M, D)
                                        	t_0 = Float64(Float64(D * Float64(0.5 / d)) * M)
                                        	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 * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 2e+239)
                                        		tmp = Float64(Float64(fma(Float64(Float64(Float64(h / l) * -0.5) * t_0), t_0, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
                                        	else
                                        		tmp = abs(Float64(d / sqrt(Float64(l * h))));
                                        	end
                                        	return tmp
                                        end
                                        
                                        code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]}, 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 * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+239], N[(N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        t_0 := \left(D \cdot \frac{0.5}{d}\right) \cdot M\\
                                        \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^{+239}:\\
                                        \;\;\;\;\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_0, t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
                                        
                                        
                                        \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)))) < 1.99999999999999998e239

                                          1. Initial program 89.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. 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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)} \]
                                            2. *-commutativeN/A

                                              \[\leadsto \color{blue}{\left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          if 1.99999999999999998e239 < (*.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 17.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                          4. 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-*.f6429.7

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

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

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

                                                \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                            3. Recombined 2 regimes into one program.
                                            4. Final simplification77.9%

                                              \[\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^{+239}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot \left(\left(D \cdot \frac{0.5}{d}\right) \cdot M\right), \left(D \cdot \frac{0.5}{d}\right) \cdot M, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                            5. Add Preprocessing

                                            Alternative 10: 45.2% accurate, 0.5× speedup?

                                            \[\begin{array}{l} \\ \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^{-182}:\\ \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \end{array} \]
                                            (FPCore (d h l 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 D) (* 2.0 d)) 2.0)) (/ h l))))
                                                  5e-182)
                                               (* (sqrt (pow (* l h) -1.0)) d)
                                               (fabs (/ d (sqrt (* l h))))))
                                            double code(double d, double h, double l, double 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 * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e-182) {
                                            		tmp = sqrt(pow((l * h), -1.0)) * d;
                                            	} else {
                                            		tmp = fabs((d / sqrt((l * h))));
                                            	}
                                            	return tmp;
                                            }
                                            
                                            real(8) function code(d, h, l, m, d_1)
                                                real(8), intent (in) :: d
                                                real(8), intent (in) :: h
                                                real(8), intent (in) :: l
                                                real(8), intent (in) :: m
                                                real(8), intent (in) :: d_1
                                                real(8) :: tmp
                                                if (((((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= 5d-182) then
                                                    tmp = sqrt(((l * h) ** (-1.0d0))) * d
                                                else
                                                    tmp = abs((d / sqrt((l * h))))
                                                end if
                                                code = tmp
                                            end function
                                            
                                            public static double code(double d, double h, double l, double M, double D) {
                                            	double tmp;
                                            	if (((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 * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e-182) {
                                            		tmp = Math.sqrt(Math.pow((l * h), -1.0)) * d;
                                            	} else {
                                            		tmp = Math.abs((d / Math.sqrt((l * h))));
                                            	}
                                            	return tmp;
                                            }
                                            
                                            def code(d, h, l, 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 * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e-182:
                                            		tmp = math.sqrt(math.pow((l * h), -1.0)) * d
                                            	else:
                                            		tmp = math.fabs((d / math.sqrt((l * h))))
                                            	return tmp
                                            
                                            function code(d, h, l, 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 * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e-182)
                                            		tmp = Float64(sqrt((Float64(l * h) ^ -1.0)) * d);
                                            	else
                                            		tmp = abs(Float64(d / sqrt(Float64(l * h))));
                                            	end
                                            	return tmp
                                            end
                                            
                                            function tmp_2 = code(d, h, l, 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 * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= 5e-182)
                                            		tmp = sqrt(((l * h) ^ -1.0)) * d;
                                            	else
                                            		tmp = abs((d / sqrt((l * h))));
                                            	end
                                            	tmp_2 = tmp;
                                            end
                                            
                                            code[d_, h_, l_, 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 * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-182], N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            \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^{-182}:\\
                                            \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
                                            
                                            
                                            \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)))) < 5.00000000000000024e-182

                                              1. Initial program 84.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                              4. 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-*.f6417.6

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

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

                                              if 5.00000000000000024e-182 < (*.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 52.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                              4. 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-*.f6433.2

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

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

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

                                                    \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                3. Recombined 2 regimes into one program.
                                                4. Final simplification41.7%

                                                  \[\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^{-182}:\\ \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                                5. Add Preprocessing

                                                Alternative 11: 46.7% accurate, 0.6× speedup?

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

                                                  1. Initial program 87.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                  4. 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-*.f6410.5

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

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

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

                                                    if -9.9999999999999998e-122 < (*.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 55.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. Taylor expanded in d around inf

                                                      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                    4. 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-*.f6435.5

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

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

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

                                                          \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                      3. Recombined 2 regimes into one program.
                                                      4. Final simplification41.7%

                                                        \[\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 -1 \cdot 10^{-121}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                                      5. Add Preprocessing

                                                      Alternative 12: 78.4% accurate, 2.2× speedup?

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

                                                        1. Initial program 69.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 rewrites80.9%

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

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

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

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

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

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

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

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

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

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

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

                                                        if -4.999999999999985e-310 < l < 1.54999999999999992e166

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

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

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

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

                                                        if 1.54999999999999992e166 < l

                                                        1. Initial program 62.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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                        4. 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-*.f6446.3

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

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

                                                            \[\leadsto \frac{{h}^{-0.5}}{\sqrt{\ell}} \cdot d \]
                                                        7. Recombined 3 regimes into one program.
                                                        8. Add Preprocessing

                                                        Alternative 13: 45.7% accurate, 3.2× speedup?

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

                                                          1. Initial program 65.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 l around -inf

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

                                                              \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                            5. mul-1-negN/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-*.f6431.9

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

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

                                                          if 3.0999999999999998e-121 < d

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

                                                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                          4. 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-*.f6449.8

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

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

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

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

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

                                                            Alternative 14: 26.2% accurate, 15.3× speedup?

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

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

                                                              \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                            4. 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-*.f6425.8

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

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

                                                                \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                              2. Add Preprocessing

                                                              Reproduce

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