Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.3% → 82.0%
Time: 1.9min
Alternatives: 20
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 20 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: 82.0% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 63.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. Simplified64.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.999999999999988e-310 < l

    1. Initial program 62.8%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 63.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. Simplified64.4%

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

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

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

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

    if -3.999999999999988e-310 < l

    1. Initial program 62.8%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 81.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 63.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. Simplified64.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.999999999999988e-310 < l

    1. Initial program 62.8%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 72.6% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(-1 + \ell \cdot \frac{-1}{\frac{-1}{h}}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -2.15000000000000021e208

    1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative85.7%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified87.8%

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

    if -2.15000000000000021e208 < d < -1.8999999999999999e-243

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8999999999999999e-243 < d < -4.999999999999985e-310

    1. Initial program 47.2%

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

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

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

        \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{1}{h \cdot \ell}}\right)} - 1\right)} \]
      3. inv-pow8.6%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right)} - 1\right) \]
      4. sqrt-pow18.6%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right)} - 1\right) \]
      5. metadata-eval8.6%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right)} - 1\right) \]
    5. Applied egg-rr8.6%

      \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{-0.5}\right)} - 1\right)} \]
    6. Taylor expanded in h around -inf 2.1%

      \[\leadsto d \cdot \color{blue}{e^{-0.5 \cdot \left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)}} \]
    7. Step-by-step derivation
      1. log1p-expm1-u54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)\right)}} \]
      2. expm1-undefine54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{e^{\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)} - 1}\right)} \]
      3. exp-sum54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{e^{\log \left(-1 \cdot \ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)}} - 1\right)} \]
      4. add-exp-log54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{\left(-1 \cdot \ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)} - 1\right)} \]
      5. mul-1-neg54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{\left(-\ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)} - 1\right)} \]
      6. mul-1-neg54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\left(-\ell\right) \cdot e^{\color{blue}{-\log \left(\frac{-1}{h}\right)}} - 1\right)} \]
      7. exp-neg54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\left(-\ell\right) \cdot \color{blue}{\frac{1}{e^{\log \left(\frac{-1}{h}\right)}}} - 1\right)} \]
      8. add-exp-log54.6%

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

      \[\leadsto d \cdot e^{-0.5 \cdot \color{blue}{\mathsf{log1p}\left(\left(-\ell\right) \cdot \frac{1}{\frac{-1}{h}} - 1\right)}} \]

    if -4.999999999999985e-310 < d

    1. Initial program 62.8%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 68.1% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(-1 + \ell \cdot \frac{-1}{\frac{-1}{h}}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -1.84999999999999994e208

    1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative85.7%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified87.8%

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

    if -1.84999999999999994e208 < d < -2.5e-243

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5e-243 < d < -4.999999999999985e-310

    1. Initial program 47.2%

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

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

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

        \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{1}{h \cdot \ell}}\right)} - 1\right)} \]
      3. inv-pow8.6%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right)} - 1\right) \]
      4. sqrt-pow18.6%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right)} - 1\right) \]
      5. metadata-eval8.6%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right)} - 1\right) \]
    5. Applied egg-rr8.6%

      \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{-0.5}\right)} - 1\right)} \]
    6. Taylor expanded in h around -inf 2.1%

      \[\leadsto d \cdot \color{blue}{e^{-0.5 \cdot \left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)}} \]
    7. Step-by-step derivation
      1. log1p-expm1-u54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)\right)}} \]
      2. expm1-undefine54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{e^{\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)} - 1}\right)} \]
      3. exp-sum54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{e^{\log \left(-1 \cdot \ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)}} - 1\right)} \]
      4. add-exp-log54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{\left(-1 \cdot \ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)} - 1\right)} \]
      5. mul-1-neg54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{\left(-\ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)} - 1\right)} \]
      6. mul-1-neg54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\left(-\ell\right) \cdot e^{\color{blue}{-\log \left(\frac{-1}{h}\right)}} - 1\right)} \]
      7. exp-neg54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\left(-\ell\right) \cdot \color{blue}{\frac{1}{e^{\log \left(\frac{-1}{h}\right)}}} - 1\right)} \]
      8. add-exp-log54.6%

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

      \[\leadsto d \cdot e^{-0.5 \cdot \color{blue}{\mathsf{log1p}\left(\left(-\ell\right) \cdot \frac{1}{\frac{-1}{h}} - 1\right)}} \]

    if -4.999999999999985e-310 < d

    1. Initial program 62.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 68.4% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(-1 + \ell \cdot \frac{-1}{\frac{-1}{h}}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -1.84999999999999994e208

    1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative85.7%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified87.8%

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

    if -1.84999999999999994e208 < d < -8.4999999999999999e-244

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.4999999999999999e-244 < d < -4.999999999999985e-310

    1. Initial program 47.2%

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

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

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

        \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{1}{h \cdot \ell}}\right)} - 1\right)} \]
      3. inv-pow8.6%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right)} - 1\right) \]
      4. sqrt-pow18.6%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right)} - 1\right) \]
      5. metadata-eval8.6%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right)} - 1\right) \]
    5. Applied egg-rr8.6%

      \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{-0.5}\right)} - 1\right)} \]
    6. Taylor expanded in h around -inf 2.1%

      \[\leadsto d \cdot \color{blue}{e^{-0.5 \cdot \left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)}} \]
    7. Step-by-step derivation
      1. log1p-expm1-u54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)\right)}} \]
      2. expm1-undefine54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{e^{\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)} - 1}\right)} \]
      3. exp-sum54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{e^{\log \left(-1 \cdot \ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)}} - 1\right)} \]
      4. add-exp-log54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{\left(-1 \cdot \ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)} - 1\right)} \]
      5. mul-1-neg54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{\left(-\ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)} - 1\right)} \]
      6. mul-1-neg54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\left(-\ell\right) \cdot e^{\color{blue}{-\log \left(\frac{-1}{h}\right)}} - 1\right)} \]
      7. exp-neg54.6%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\left(-\ell\right) \cdot \color{blue}{\frac{1}{e^{\log \left(\frac{-1}{h}\right)}}} - 1\right)} \]
      8. add-exp-log54.6%

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

      \[\leadsto d \cdot e^{-0.5 \cdot \color{blue}{\mathsf{log1p}\left(\left(-\ell\right) \cdot \frac{1}{\frac{-1}{h}} - 1\right)}} \]

    if -4.999999999999985e-310 < d

    1. Initial program 62.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 75.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative85.7%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified87.8%

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

    if -2.1e209 < d < -1.09999999999999991e-282

    1. Initial program 69.8%

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

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

    if -1.09999999999999991e-282 < d

    1. Initial program 60.8%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 75.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative85.7%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified87.8%

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

    if -4.0000000000000003e209 < d < -1.09999999999999991e-282

    1. Initial program 69.8%

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

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

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

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

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

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

    if -1.09999999999999991e-282 < d

    1. Initial program 60.8%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 75.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative85.7%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified87.8%

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

    if -5.29999999999999995e209 < d < -1.09999999999999991e-282

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

    if -1.09999999999999991e-282 < d

    1. Initial program 60.8%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 76.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative85.7%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified87.8%

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

    if -2.2500000000000002e209 < d < -1.09999999999999991e-282

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.09999999999999991e-282 < d

    1. Initial program 60.8%

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

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

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

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

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

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

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

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

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

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

Alternative 11: 44.1% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;h \leq -0.00155:\\
\;\;\;\;\frac{d}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}\\

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

\mathbf{elif}\;h \leq 4 \cdot 10^{+27}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if h < -2.80000000000000012e75

    1. Initial program 44.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. Simplified44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative30.7%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified31.6%

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

    if -2.80000000000000012e75 < h < -0.00154999999999999995

    1. Initial program 71.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. Simplified69.5%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
      3. unpow1/24.4%

        \[\leadsto \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \cdot d \]
      4. associate-/r*4.4%

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

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      6. exp-neg4.4%

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

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

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

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

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

        \[\leadsto e^{-\log \color{blue}{\left(\sqrt{h \cdot \ell}\right)}} \cdot d \]
      12. rec-exp4.4%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(\sqrt{h \cdot \ell}\right)}}} \cdot d \]
      13. rem-exp-log4.4%

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

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      15. *-lft-identity4.4%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      16. remove-double-neg4.4%

        \[\leadsto \frac{\color{blue}{-\left(-d\right)}}{\sqrt{h \cdot \ell}} \]
      17. remove-double-neg4.4%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    8. Simplified4.4%

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

        \[\leadsto \frac{d}{\color{blue}{\log \left(e^{\sqrt{h \cdot \ell}}\right)}} \]
      2. *-commutative47.5%

        \[\leadsto \frac{d}{\log \left(e^{\sqrt{\color{blue}{\ell \cdot h}}}\right)} \]
    10. Applied egg-rr47.5%

      \[\leadsto \frac{d}{\color{blue}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}} \]

    if -0.00154999999999999995 < h < -5.00000000000023e-311

    1. Initial program 75.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. Simplified76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative56.8%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. *-commutative56.8%

        \[\leadsto -\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
      4. distribute-rgt-neg-in56.8%

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

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

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

    if -5.00000000000023e-311 < h < 4.0000000000000001e27

    1. Initial program 68.2%

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval63.1%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
      3. sqrt-unprod71.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      2. *-commutative71.3%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Simplified71.3%

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

    if 4.0000000000000001e27 < h

    1. Initial program 55.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. Simplified56.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.125 \cdot \frac{\left(\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
      4. swap-sqr56.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -2.8 \cdot 10^{+75}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;h \leq -0.00155:\\ \;\;\;\;\frac{d}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}\\ \mathbf{elif}\;h \leq -5 \cdot 10^{-311}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;h \leq 4 \cdot 10^{+27}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left({\left(M \cdot D\right)}^{2} \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}}}{d}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 44.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;h \leq -0.00155:\\
\;\;\;\;\frac{d}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}\\

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

\mathbf{elif}\;h \leq 7.8 \cdot 10^{+31}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if h < -4.19999999999999997e75

    1. Initial program 44.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. Simplified44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative30.7%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified31.6%

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

    if -4.19999999999999997e75 < h < -0.00154999999999999995

    1. Initial program 71.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. Simplified69.5%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
      3. unpow1/24.4%

        \[\leadsto \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \cdot d \]
      4. associate-/r*4.4%

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

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
      6. exp-neg4.4%

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

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

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

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

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

        \[\leadsto e^{-\log \color{blue}{\left(\sqrt{h \cdot \ell}\right)}} \cdot d \]
      12. rec-exp4.4%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(\sqrt{h \cdot \ell}\right)}}} \cdot d \]
      13. rem-exp-log4.4%

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

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      15. *-lft-identity4.4%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      16. remove-double-neg4.4%

        \[\leadsto \frac{\color{blue}{-\left(-d\right)}}{\sqrt{h \cdot \ell}} \]
      17. remove-double-neg4.4%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    8. Simplified4.4%

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

        \[\leadsto \frac{d}{\color{blue}{\log \left(e^{\sqrt{h \cdot \ell}}\right)}} \]
      2. *-commutative47.5%

        \[\leadsto \frac{d}{\log \left(e^{\sqrt{\color{blue}{\ell \cdot h}}}\right)} \]
    10. Applied egg-rr47.5%

      \[\leadsto \frac{d}{\color{blue}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}} \]

    if -0.00154999999999999995 < h < -5.00000000000023e-311

    1. Initial program 75.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. Simplified76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative56.8%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. *-commutative56.8%

        \[\leadsto -\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
      4. distribute-rgt-neg-in56.8%

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

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

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

    if -5.00000000000023e-311 < h < 7.79999999999999999e31

    1. Initial program 68.2%

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval63.1%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
      3. sqrt-unprod71.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      2. *-commutative71.3%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Simplified71.3%

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

    if 7.79999999999999999e31 < h

    1. Initial program 55.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 0 54.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot -0.125\right) \]
      3. swap-sqr58.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -4.2 \cdot 10^{+75}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;h \leq -0.00155:\\ \;\;\;\;\frac{d}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}\\ \mathbf{elif}\;h \leq -5 \cdot 10^{-311}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;h \leq 7.8 \cdot 10^{+31}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot -0.125\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 60.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\log \left(e^{t\_0}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -9.5000000000000005e-199

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative49.8%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified50.3%

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

    if -9.5000000000000005e-199 < d < -4.999999999999985e-310

    1. Initial program 57.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
      3. unpow1/212.9%

        \[\leadsto \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \cdot d \]
      4. associate-/r*12.9%

        \[\leadsto {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{0.5} \cdot d \]
      5. rem-exp-log12.9%

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

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

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

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

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

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

        \[\leadsto e^{-\log \color{blue}{\left(\sqrt{h \cdot \ell}\right)}} \cdot d \]
      12. rec-exp9.4%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(\sqrt{h \cdot \ell}\right)}}} \cdot d \]
      13. rem-exp-log9.4%

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

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      15. *-lft-identity9.4%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      16. remove-double-neg9.4%

        \[\leadsto \frac{\color{blue}{-\left(-d\right)}}{\sqrt{h \cdot \ell}} \]
      17. remove-double-neg9.4%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    8. Simplified9.4%

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

        \[\leadsto \frac{d}{\color{blue}{\log \left(e^{\sqrt{h \cdot \ell}}\right)}} \]
      2. *-commutative51.4%

        \[\leadsto \frac{d}{\log \left(e^{\sqrt{\color{blue}{\ell \cdot h}}}\right)} \]
    10. Applied egg-rr51.4%

      \[\leadsto \frac{d}{\color{blue}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}} \]

    if -4.999999999999985e-310 < d

    1. Initial program 62.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 47.3% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -6.1999999999999997e-198

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative49.8%

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

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified50.3%

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

    if -6.1999999999999997e-198 < d < -4.999999999999985e-310

    1. Initial program 57.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
      3. unpow1/212.9%

        \[\leadsto \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \cdot d \]
      4. associate-/r*12.9%

        \[\leadsto {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{0.5} \cdot d \]
      5. rem-exp-log12.9%

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

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

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

        \[\leadsto e^{\color{blue}{0.5 \cdot \left(-\log \left(h \cdot \ell\right)\right)}} \cdot d \]
      9. distribute-rgt-neg-out9.4%

        \[\leadsto e^{\color{blue}{-0.5 \cdot \log \left(h \cdot \ell\right)}} \cdot d \]
      10. log-pow9.4%

        \[\leadsto e^{-\color{blue}{\log \left({\left(h \cdot \ell\right)}^{0.5}\right)}} \cdot d \]
      11. unpow1/29.4%

        \[\leadsto e^{-\log \color{blue}{\left(\sqrt{h \cdot \ell}\right)}} \cdot d \]
      12. rec-exp9.4%

        \[\leadsto \color{blue}{\frac{1}{e^{\log \left(\sqrt{h \cdot \ell}\right)}}} \cdot d \]
      13. rem-exp-log9.4%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
      14. associate-*l/9.4%

        \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
      15. *-lft-identity9.4%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
      16. remove-double-neg9.4%

        \[\leadsto \frac{\color{blue}{-\left(-d\right)}}{\sqrt{h \cdot \ell}} \]
      17. remove-double-neg9.4%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    8. Simplified9.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    9. Step-by-step derivation
      1. add-log-exp51.4%

        \[\leadsto \frac{d}{\color{blue}{\log \left(e^{\sqrt{h \cdot \ell}}\right)}} \]
      2. *-commutative51.4%

        \[\leadsto \frac{d}{\log \left(e^{\sqrt{\color{blue}{\ell \cdot h}}}\right)} \]
    10. Applied egg-rr51.4%

      \[\leadsto \frac{d}{\color{blue}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}} \]

    if -4.999999999999985e-310 < d

    1. Initial program 62.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in d around inf 43.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. sqrt-div43.7%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval43.7%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
      3. sqrt-unprod49.8%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      4. div-inv49.9%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      5. associate-/r*47.5%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    5. Applied egg-rr47.5%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    6. Step-by-step derivation
      1. associate-/l/49.9%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      2. *-commutative49.9%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Simplified49.9%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -6.2 \cdot 10^{-198}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 47.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -1.1 \cdot 10^{-197}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(-1 + \ell \cdot \frac{-1}{\frac{-1}{h}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -1.1e-197)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (if (<= d -5e-310)
     (* d (exp (* -0.5 (log1p (+ -1.0 (* l (/ -1.0 (/ -1.0 h))))))))
     (/ d (* (sqrt h) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.1e-197) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else if (d <= -5e-310) {
		tmp = d * exp((-0.5 * log1p((-1.0 + (l * (-1.0 / (-1.0 / h)))))));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.1e-197) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else if (d <= -5e-310) {
		tmp = d * Math.exp((-0.5 * Math.log1p((-1.0 + (l * (-1.0 / (-1.0 / h)))))));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if d <= -1.1e-197:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	elif d <= -5e-310:
		tmp = d * math.exp((-0.5 * math.log1p((-1.0 + (l * (-1.0 / (-1.0 / h)))))))
	else:
		tmp = d / (math.sqrt(h) * math.sqrt(l))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -1.1e-197)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	elseif (d <= -5e-310)
		tmp = Float64(d * exp(Float64(-0.5 * log1p(Float64(-1.0 + Float64(l * Float64(-1.0 / Float64(-1.0 / h))))))));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.1e-197], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Exp[N[(-0.5 * N[Log[1 + N[(-1.0 + N[(l * N[(-1.0 / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.1 \cdot 10^{-197}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(-1 + \ell \cdot \frac{-1}{\frac{-1}{h}}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.1e-197

    1. Initial program 65.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. Simplified66.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-*r*66.1%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot -0.5}\right)\right) \]
      2. *-commutative66.1%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)} \cdot -0.5\right)\right) \]
      3. associate-*r/70.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}} \cdot -0.5\right)\right) \]
      4. associate-*l/70.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}}\right)\right) \]
      5. div-inv70.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      6. associate-*l*70.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(M \cdot \left(\frac{1}{2} \cdot \frac{D}{d}\right)\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      7. metadata-eval70.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(M \cdot \left(\color{blue}{0.5} \cdot \frac{D}{d}\right)\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    5. Applied egg-rr70.2%

      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*70.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      2. metadata-eval70.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\left(M \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      3. div-inv70.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      4. associate-*r/69.6%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(\frac{\frac{M}{2} \cdot D}{d}\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      5. div-inv69.6%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      6. metadata-eval69.6%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot \color{blue}{0.5}\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    7. Applied egg-rr69.6%

      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    8. Step-by-step derivation
      1. clear-num69.6%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\frac{\ell}{d}}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      2. sqrt-div69.5%

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{d}}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      3. metadata-eval69.5%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{d}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    9. Applied egg-rr69.5%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\frac{\ell}{d}}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    10. Taylor expanded in d around -inf 49.8%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    11. Step-by-step derivation
      1. mul-1-neg49.8%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative49.8%

        \[\leadsto -d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      3. associate-/r*50.3%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified50.3%

      \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]

    if -1.1e-197 < d < -4.999999999999985e-310

    1. Initial program 57.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in d around inf 12.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. expm1-log1p-u12.9%

        \[\leadsto d \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
      2. expm1-undefine12.9%

        \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{1}{h \cdot \ell}}\right)} - 1\right)} \]
      3. inv-pow12.9%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right)} - 1\right) \]
      4. sqrt-pow19.5%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right)} - 1\right) \]
      5. metadata-eval9.5%

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right)} - 1\right) \]
    5. Applied egg-rr9.5%

      \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{-0.5}\right)} - 1\right)} \]
    6. Taylor expanded in h around -inf 6.1%

      \[\leadsto d \cdot \color{blue}{e^{-0.5 \cdot \left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)}} \]
    7. Step-by-step derivation
      1. log1p-expm1-u51.3%

        \[\leadsto d \cdot e^{-0.5 \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)\right)\right)}} \]
      2. expm1-undefine51.3%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{e^{\log \left(-1 \cdot \ell\right) + -1 \cdot \log \left(\frac{-1}{h}\right)} - 1}\right)} \]
      3. exp-sum51.3%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{e^{\log \left(-1 \cdot \ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)}} - 1\right)} \]
      4. add-exp-log51.3%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{\left(-1 \cdot \ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)} - 1\right)} \]
      5. mul-1-neg51.3%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\color{blue}{\left(-\ell\right)} \cdot e^{-1 \cdot \log \left(\frac{-1}{h}\right)} - 1\right)} \]
      6. mul-1-neg51.3%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\left(-\ell\right) \cdot e^{\color{blue}{-\log \left(\frac{-1}{h}\right)}} - 1\right)} \]
      7. exp-neg51.3%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\left(-\ell\right) \cdot \color{blue}{\frac{1}{e^{\log \left(\frac{-1}{h}\right)}}} - 1\right)} \]
      8. add-exp-log51.3%

        \[\leadsto d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(\left(-\ell\right) \cdot \frac{1}{\color{blue}{\frac{-1}{h}}} - 1\right)} \]
    8. Applied egg-rr51.3%

      \[\leadsto d \cdot e^{-0.5 \cdot \color{blue}{\mathsf{log1p}\left(\left(-\ell\right) \cdot \frac{1}{\frac{-1}{h}} - 1\right)}} \]

    if -4.999999999999985e-310 < d

    1. Initial program 62.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in d around inf 43.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. sqrt-div43.7%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval43.7%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
      3. sqrt-unprod49.8%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      4. div-inv49.9%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      5. associate-/r*47.5%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    5. Applied egg-rr47.5%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    6. Step-by-step derivation
      1. associate-/l/49.9%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      2. *-commutative49.9%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Simplified49.9%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.1 \cdot 10^{-197}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot e^{-0.5 \cdot \mathsf{log1p}\left(-1 + \ell \cdot \frac{-1}{\frac{-1}{h}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 46.1% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq 1.1 \cdot 10^{-289}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d 1.1e-289)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (/ d (* (sqrt h) (sqrt l)))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 1.1e-289) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= 1.1d-289) then
        tmp = d * -sqrt(((1.0d0 / l) / h))
    else
        tmp = d / (sqrt(h) * sqrt(l))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 1.1e-289) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if d <= 1.1e-289:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	else:
		tmp = d / (math.sqrt(h) * math.sqrt(l))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= 1.1e-289)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= 1.1e-289)
		tmp = d * -sqrt(((1.0 / l) / h));
	else
		tmp = d / (sqrt(h) * sqrt(l));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 1.1e-289], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.1 \cdot 10^{-289}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 1.1e-289

    1. Initial program 62.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified63.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-*r*63.3%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot -0.5}\right)\right) \]
      2. *-commutative63.3%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)} \cdot -0.5\right)\right) \]
      3. associate-*r/66.4%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}} \cdot -0.5\right)\right) \]
      4. associate-*l/66.4%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}}\right)\right) \]
      5. div-inv66.4%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      6. associate-*l*66.4%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(M \cdot \left(\frac{1}{2} \cdot \frac{D}{d}\right)\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      7. metadata-eval66.4%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(M \cdot \left(\color{blue}{0.5} \cdot \frac{D}{d}\right)\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    5. Applied egg-rr66.4%

      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*66.4%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      2. metadata-eval66.4%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\left(M \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      3. div-inv66.4%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      4. associate-*r/66.0%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(\frac{\frac{M}{2} \cdot D}{d}\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      5. div-inv66.0%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      6. metadata-eval66.0%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot \color{blue}{0.5}\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    7. Applied egg-rr66.0%

      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    8. Step-by-step derivation
      1. clear-num66.0%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\frac{\ell}{d}}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      2. sqrt-div65.9%

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{d}}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      3. metadata-eval65.9%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{d}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    9. Applied egg-rr65.9%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\frac{\ell}{d}}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    10. Taylor expanded in d around -inf 41.7%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    11. Step-by-step derivation
      1. mul-1-neg41.7%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative41.7%

        \[\leadsto -d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      3. associate-/r*42.0%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified42.0%

      \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]

    if 1.1e-289 < d

    1. Initial program 64.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in d around inf 45.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. sqrt-div45.1%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval45.1%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
      3. sqrt-unprod51.4%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      4. div-inv51.5%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      5. associate-/r*49.1%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    5. Applied egg-rr49.1%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    6. Step-by-step derivation
      1. associate-/l/51.5%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      2. *-commutative51.5%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Simplified51.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.1 \cdot 10^{-289}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 42.2% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -2.7 \cdot 10^{-241}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -2.7e-241)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (* d (sqrt (/ 1.0 (* l h))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -2.7e-241) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else {
		tmp = d * sqrt((1.0 / (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 <= (-2.7d-241)) then
        tmp = d * -sqrt(((1.0d0 / l) / h))
    else
        tmp = d * sqrt((1.0d0 / (l * h)))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -2.7e-241) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = d * Math.sqrt((1.0 / (l * h)));
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if d <= -2.7e-241:
		tmp = d * -math.sqrt(((1.0 / l) / h))
	else:
		tmp = d * math.sqrt((1.0 / (l * h)))
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -2.7e-241)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	else
		tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= -2.7e-241)
		tmp = d * -sqrt(((1.0 / l) / h));
	else
		tmp = d * sqrt((1.0 / (l * h)));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.7e-241], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.7 \cdot 10^{-241}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -2.6999999999999999e-241

    1. Initial program 65.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-*r*66.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot -0.5}\right)\right) \]
      2. *-commutative66.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)} \cdot -0.5\right)\right) \]
      3. associate-*r/69.9%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}} \cdot -0.5\right)\right) \]
      4. associate-*l/69.9%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}}\right)\right) \]
      5. div-inv69.9%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      6. associate-*l*69.9%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(M \cdot \left(\frac{1}{2} \cdot \frac{D}{d}\right)\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      7. metadata-eval69.9%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(M \cdot \left(\color{blue}{0.5} \cdot \frac{D}{d}\right)\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    5. Applied egg-rr69.9%

      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \color{blue}{\frac{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*69.9%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      2. metadata-eval69.9%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\left(M \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      3. div-inv69.9%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      4. associate-*r/69.3%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(\frac{\frac{M}{2} \cdot D}{d}\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      5. div-inv69.3%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      6. metadata-eval69.3%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot \color{blue}{0.5}\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    7. Applied egg-rr69.3%

      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    8. Step-by-step derivation
      1. clear-num69.3%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\frac{\ell}{d}}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      2. sqrt-div69.3%

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{d}}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
      3. metadata-eval69.3%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{d}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    9. Applied egg-rr69.3%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\frac{\ell}{d}}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left({\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}^{2} \cdot h\right) \cdot -0.5}{\ell}\right)\right) \]
    10. Taylor expanded in d around -inf 48.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    11. Step-by-step derivation
      1. mul-1-neg48.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative48.3%

        \[\leadsto -d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      3. associate-/r*48.7%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    12. Simplified48.7%

      \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]

    if -2.6999999999999999e-241 < d

    1. Initial program 61.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in d around inf 39.6%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.7 \cdot 10^{-241}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 26.1% accurate, 3.1× speedup?

\[\begin{array}{l} \\ d \cdot \sqrt{\frac{1}{\ell \cdot h}} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (sqrt (/ 1.0 (* l h)))))
double code(double d, double h, double l, double M, double D) {
	return d * sqrt((1.0 / (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((1.0d0 / (l * h)))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.sqrt((1.0 / (l * h)));
}
def code(d, h, l, M, D):
	return d * math.sqrt((1.0 / (l * h)))
function code(d, h, l, M, D)
	return Float64(d * sqrt(Float64(1.0 / Float64(l * h))))
end
function tmp = code(d, h, l, M, D)
	tmp = d * sqrt((1.0 / (l * h)));
end
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 63.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 25.1%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  4. Final simplification25.1%

    \[\leadsto d \cdot \sqrt{\frac{1}{\ell \cdot h}} \]
  5. Add Preprocessing

Alternative 19: 26.1% accurate, 3.1× speedup?

\[\begin{array}{l} \\ d \cdot {\left(\ell \cdot h\right)}^{-0.5} \end{array} \]
(FPCore (d h l M D) :precision binary64 (* d (pow (* l h) -0.5)))
double code(double d, double h, double l, double M, double D) {
	return d * pow((l * h), -0.5);
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d * ((l * h) ** (-0.5d0))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.pow((l * h), -0.5);
}
def code(d, h, l, M, D):
	return d * math.pow((l * h), -0.5)
function code(d, h, l, M, D)
	return Float64(d * (Float64(l * h) ^ -0.5))
end
function tmp = code(d, h, l, M, D)
	tmp = d * ((l * h) ^ -0.5);
end
code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 63.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. Simplified63.6%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-*r/65.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    2. div-inv65.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
    3. associate-*l*65.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(M \cdot \left(\frac{1}{2} \cdot \frac{D}{d}\right)\right)}}^{2} \cdot h}{\ell}\right) \]
    4. metadata-eval65.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(M \cdot \left(\color{blue}{0.5} \cdot \frac{D}{d}\right)\right)}^{2} \cdot h}{\ell}\right) \]
  5. Applied egg-rr65.4%

    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot h}{\ell}}\right) \]
  6. Taylor expanded in d around inf 25.1%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  7. Step-by-step derivation
    1. unpow-125.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
    2. metadata-eval25.1%

      \[\leadsto d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
    3. pow-sqr25.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}} \]
    4. rem-sqrt-square24.7%

      \[\leadsto d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|} \]
    5. rem-square-sqrt24.6%

      \[\leadsto d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right| \]
    6. fabs-sqr24.6%

      \[\leadsto d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)} \]
    7. rem-square-sqrt24.7%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  8. Simplified24.7%

    \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
  9. Final simplification24.7%

    \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{-0.5} \]
  10. Add Preprocessing

Alternative 20: 26.1% accurate, 3.2× speedup?

\[\begin{array}{l} \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
double code(double d, double h, double l, double M, double D) {
	return d / sqrt((l * h));
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d / sqrt((l * h))
end function
public static double code(double d, double h, double l, double M, double D) {
	return d / Math.sqrt((l * h));
}
def code(d, h, l, M, D):
	return d / math.sqrt((l * h))
function code(d, h, l, M, D)
	return Float64(d / sqrt(Float64(l * h)))
end
function tmp = code(d, h, l, M, D)
	tmp = d / sqrt((l * h));
end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 63.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. Simplified63.6%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-*r/65.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    2. div-inv65.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right) \]
    3. associate-*l*65.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(M \cdot \left(\frac{1}{2} \cdot \frac{D}{d}\right)\right)}}^{2} \cdot h}{\ell}\right) \]
    4. metadata-eval65.4%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(M \cdot \left(\color{blue}{0.5} \cdot \frac{D}{d}\right)\right)}^{2} \cdot h}{\ell}\right) \]
  5. Applied egg-rr65.4%

    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot h}{\ell}}\right) \]
  6. Taylor expanded in d around inf 25.1%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  7. Step-by-step derivation
    1. *-commutative25.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
    2. associate-/r*25.1%

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
    3. unpow1/225.1%

      \[\leadsto \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \cdot d \]
    4. associate-/r*25.1%

      \[\leadsto {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{0.5} \cdot d \]
    5. rem-exp-log24.2%

      \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \cdot d \]
    6. exp-neg24.2%

      \[\leadsto {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \cdot d \]
    7. exp-prod23.8%

      \[\leadsto \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \cdot d \]
    8. *-commutative23.8%

      \[\leadsto e^{\color{blue}{0.5 \cdot \left(-\log \left(h \cdot \ell\right)\right)}} \cdot d \]
    9. distribute-rgt-neg-out23.8%

      \[\leadsto e^{\color{blue}{-0.5 \cdot \log \left(h \cdot \ell\right)}} \cdot d \]
    10. log-pow23.8%

      \[\leadsto e^{-\color{blue}{\log \left({\left(h \cdot \ell\right)}^{0.5}\right)}} \cdot d \]
    11. unpow1/223.8%

      \[\leadsto e^{-\log \color{blue}{\left(\sqrt{h \cdot \ell}\right)}} \cdot d \]
    12. rec-exp23.8%

      \[\leadsto \color{blue}{\frac{1}{e^{\log \left(\sqrt{h \cdot \ell}\right)}}} \cdot d \]
    13. rem-exp-log24.7%

      \[\leadsto \frac{1}{\color{blue}{\sqrt{h \cdot \ell}}} \cdot d \]
    14. associate-*l/24.7%

      \[\leadsto \color{blue}{\frac{1 \cdot d}{\sqrt{h \cdot \ell}}} \]
    15. *-lft-identity24.7%

      \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    16. remove-double-neg24.7%

      \[\leadsto \frac{\color{blue}{-\left(-d\right)}}{\sqrt{h \cdot \ell}} \]
    17. remove-double-neg24.7%

      \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
  8. Simplified24.7%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  9. Final simplification24.7%

    \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2024046 
(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)))))