Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.9% → 83.4%
Time: 1.5min
Alternatives: 15
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 15 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: 65.9% 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: 83.4% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 67.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.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. clear-num68.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 67.1%

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

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

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

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

Alternative 2: 83.4% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 67.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.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. clear-num68.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 67.1%

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

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

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

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

Alternative 3: 76.7% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -3.19999999999999982e-251

    1. Initial program 69.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.19999999999999982e-251 < h < -1.999999999999994e-310

    1. Initial program 45.2%

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < h

    1. Initial program 67.1%

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

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

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

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

Alternative 4: 63.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{-189}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_0\right)\right)\\

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

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


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

    1. Initial program 66.5%

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in52.7%

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

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

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

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

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

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

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

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

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

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

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

    if -2.20000000000000019e-189 < l < -1.999999999999994e-310

    1. Initial program 72.6%

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

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

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

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

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right)\right) \]
      4. pow-pow62.2%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right)\right) \]
      5. *-commutative62.2%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\color{blue}{\left(\ell \cdot h\right)}}^{\left(-1 \cdot 0.5\right)}\right)\right) \]
      6. metadata-eval62.2%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{\color{blue}{-0.5}}\right)\right) \]
    5. Applied egg-rr62.2%

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

    if -1.999999999999994e-310 < l < 3.0999999999999997e-51

    1. Initial program 73.6%

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

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

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

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

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

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

    if 3.0999999999999997e-51 < l

    1. Initial program 62.6%

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

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

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

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

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

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

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

Alternative 5: 73.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 37.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.99999999999999998e229 < l < 7.00000000000000054e-204

    1. Initial program 71.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. Simplified71.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. clear-num71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.00000000000000054e-204 < l

    1. Initial program 67.1%

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

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

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

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

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

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

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

Alternative 6: 72.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2e-204 < l

    1. Initial program 67.1%

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

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

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

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

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

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

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

Alternative 7: 61.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -9 \cdot 10^{-189}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_0\right)\right)\\

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


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

    1. Initial program 66.5%

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in52.7%

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

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

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

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

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

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

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

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

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

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

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

    if -8.9999999999999992e-189 < l < -1.999999999999994e-310

    1. Initial program 72.6%

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

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

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

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

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right)\right) \]
      4. pow-pow62.2%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right)\right) \]
      5. *-commutative62.2%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\color{blue}{\left(\ell \cdot h\right)}}^{\left(-1 \cdot 0.5\right)}\right)\right) \]
      6. metadata-eval62.2%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{\color{blue}{-0.5}}\right)\right) \]
    5. Applied egg-rr62.2%

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

    if -1.999999999999994e-310 < l

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 73.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0999999999999999e-204 < l

    1. Initial program 67.1%

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

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

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

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

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

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

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

Alternative 9: 73.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.49999999999999957e-205 < l

    1. Initial program 67.1%

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

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

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

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

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

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

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

Alternative 10: 73.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.7000000000000001e-204 < l

    1. Initial program 67.1%

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

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

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

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

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

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

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

Alternative 11: 47.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -4.1 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(d \cdot t\_0\right)\right)\\

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


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

    1. Initial program 66.5%

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in52.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4.1000000000000002e-190 < l < -1.999999999999994e-310

    1. Initial program 72.6%

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

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

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

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(d \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right)\right) \]
      3. inv-pow56.2%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(d \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right)\right) \]
      4. pow-pow56.2%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right)\right) \]
      5. *-commutative56.2%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(d \cdot {\color{blue}{\left(\ell \cdot h\right)}}^{\left(-1 \cdot 0.5\right)}\right)\right) \]
      6. metadata-eval56.2%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(d \cdot {\left(\ell \cdot h\right)}^{\color{blue}{-0.5}}\right)\right) \]
    5. Applied egg-rr56.2%

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

    if -1.999999999999994e-310 < l

    1. Initial program 67.1%

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

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

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

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

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

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

Alternative 12: 48.5% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{-188}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_0\right)\right)\\

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


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

    1. Initial program 66.5%

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in52.7%

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

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

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

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

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

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

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

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

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

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

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

    if -2.3e-188 < l < -1.999999999999994e-310

    1. Initial program 72.6%

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

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

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

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

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right)\right) \]
      4. pow-pow62.2%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right)\right) \]
      5. *-commutative62.2%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\color{blue}{\left(\ell \cdot h\right)}}^{\left(-1 \cdot 0.5\right)}\right)\right) \]
      6. metadata-eval62.2%

        \[\leadsto d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{\color{blue}{-0.5}}\right)\right) \]
    5. Applied egg-rr62.2%

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

    if -1.999999999999994e-310 < l

    1. Initial program 67.1%

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

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

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

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

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

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

Alternative 13: 45.9% accurate, 1.6× speedup?

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

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

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


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

    1. Initial program 64.6%

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in45.9%

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

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

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

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

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

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

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

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

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

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

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

    if 6.0000000000000004e-206 < d

    1. Initial program 71.3%

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

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

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

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

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

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

Alternative 14: 42.6% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\

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


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

    1. Initial program 66.5%

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

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

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

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

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

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in52.7%

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

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

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

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

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

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

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

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

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

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

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

    if -1.2e-190 < l

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot {\left(\ell \cdot h\right)}^{-0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.4%

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

Alternative 15: 27.2% 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 67.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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