Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.6% → 72.4%
Time: 10.6s
Alternatives: 13
Speedup: N/A×

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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
    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 13 alternatives:

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

Initial Program: 66.6% 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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
    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: 72.4% accurate, N/A× speedup?

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

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

\mathbf{elif}\;d \leq 3.2 \cdot 10^{-285}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.05e-162

    1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      14. lower-*.f6478.7

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

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{\color{blue}{2}}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      16. metadata-eval78.7

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

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

    if -1.05e-162 < d < 3.20000000000000016e-285

    1. Initial program 32.8%

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{2}}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      4. pow-powN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{\left(3 \cdot \frac{1}{2}\right)}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      7. metadata-eval64.6

        \[\leadsto \frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h} \]
    7. Applied rewrites64.6%

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

    if 3.20000000000000016e-285 < d

    1. Initial program 71.5%

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

        \[\leadsto \left({\color{blue}{\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. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\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) \]
      3. lift-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{\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) \]
      4. metadata-evalN/A

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

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      6. sqrt-divN/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]
      7. lower-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]
      8. lower-sqrt.f64N/A

        \[\leadsto \left(\frac{\color{blue}{\sqrt{d}}}{\sqrt{h}} \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) \]
      9. lower-sqrt.f6482.6

        \[\leadsto \left(\frac{\sqrt{d}}{\color{blue}{\sqrt{h}}} \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) \]
    4. Applied rewrites82.6%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.05 \cdot 10^{-162}:\\ \;\;\;\;\left(-1 \cdot \left(d \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\right)\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{elif}\;d \leq 3.2 \cdot 10^{-285}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \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} \]
  5. Add Preprocessing

Alternative 2: 71.8% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
t_1 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_2 := {\left(\frac{d}{h}\right)}^{0.125}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot t\_0\right) \cdot t\_1 \leq 5 \cdot 10^{+236}:\\
\;\;\;\;\left(\left({\left(\frac{d}{h}\right)}^{0.25} \cdot \left(t\_2 \cdot t\_2\right)\right) \cdot t\_0\right) \cdot t\_1\\

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


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

    1. Initial program 87.9%

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

        \[\leadsto \left({\color{blue}{\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. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\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) \]
      3. sqr-powN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left({\left(\frac{d}{h}\right)}^{0.25} \cdot {\color{blue}{\left(\frac{d}{h}\right)}}^{0.25}\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) \]
    4. Applied rewrites87.7%

      \[\leadsto \left(\color{blue}{\left({\left(\frac{d}{h}\right)}^{0.25} \cdot {\left(\frac{d}{h}\right)}^{0.25}\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) \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \left(\left({\left(\frac{d}{h}\right)}^{\frac{1}{4}} \cdot \color{blue}{{\left(\frac{d}{h}\right)}^{\frac{1}{4}}}\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) \]
      3. sqr-powN/A

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

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

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

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

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

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

        \[\leadsto \left(\left({\left(\frac{d}{h}\right)}^{\frac{1}{4}} \cdot \left({\left(\frac{d}{h}\right)}^{\frac{1}{8}} \cdot \color{blue}{{\left(\frac{d}{h}\right)}^{\frac{1}{8}}}\right)\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) \]
      10. lift-/.f6487.7

        \[\leadsto \left(\left({\left(\frac{d}{h}\right)}^{0.25} \cdot \left({\left(\frac{d}{h}\right)}^{0.125} \cdot {\color{blue}{\left(\frac{d}{h}\right)}}^{0.125}\right)\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) \]
    6. Applied rewrites87.7%

      \[\leadsto \left(\left({\left(\frac{d}{h}\right)}^{0.25} \cdot \color{blue}{\left({\left(\frac{d}{h}\right)}^{0.125} \cdot {\left(\frac{d}{h}\right)}^{0.125}\right)}\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) \]

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

    1. Initial program 25.2%

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{2}}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      4. pow-powN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{\left(3 \cdot \frac{1}{2}\right)}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      7. metadata-eval48.2

        \[\leadsto \frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h} \]
    7. Applied rewrites48.2%

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

Alternative 3: 63.7% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\\ t_1 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\\ \mathbf{if}\;h \leq -1.05 \cdot 10^{-297}:\\ \;\;\;\;\left(-1 \cdot \left(d \cdot t\_1\right)\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{elif}\;h \leq 6.8 \cdot 10^{-149}:\\ \;\;\;\;t\_1 \cdot d\\ \mathbf{elif}\;h \leq 2.8 \cdot 10^{+171}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_0, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, {\left(\frac{h}{{\ell}^{3}}\right)}^{0.5}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{0.5} \cdot d\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* -0.125 (/ (pow (* D M) 2.0) d)))
        (t_1 (pow (pow (* l h) -1.0) 0.5)))
   (if (<= h -1.05e-297)
     (*
      (* -1.0 (* d t_1))
      (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
     (if (<= h 6.8e-149)
       (* t_1 d)
       (if (<= h 2.8e+171)
         (/ (fma t_0 (pow (/ h l) 1.5) (* (pow (/ h l) 0.5) d)) h)
         (fma
          t_0
          (pow (/ h (pow l 3.0)) 0.5)
          (* (pow (exp (* (log (* l h)) -1.0)) 0.5) d)))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = -0.125 * (pow((D * M), 2.0) / d);
	double t_1 = pow(pow((l * h), -1.0), 0.5);
	double tmp;
	if (h <= -1.05e-297) {
		tmp = (-1.0 * (d * t_1)) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	} else if (h <= 6.8e-149) {
		tmp = t_1 * d;
	} else if (h <= 2.8e+171) {
		tmp = fma(t_0, pow((h / l), 1.5), (pow((h / l), 0.5) * d)) / h;
	} else {
		tmp = fma(t_0, pow((h / pow(l, 3.0)), 0.5), (pow(exp((log((l * h)) * -1.0)), 0.5) * d));
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d))
	t_1 = (Float64(l * h) ^ -1.0) ^ 0.5
	tmp = 0.0
	if (h <= -1.05e-297)
		tmp = Float64(Float64(-1.0 * Float64(d * t_1)) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))));
	elseif (h <= 6.8e-149)
		tmp = Float64(t_1 * d);
	elseif (h <= 2.8e+171)
		tmp = Float64(fma(t_0, (Float64(h / l) ^ 1.5), Float64((Float64(h / l) ^ 0.5) * d)) / h);
	else
		tmp = fma(t_0, (Float64(h / (l ^ 3.0)) ^ 0.5), Float64((exp(Float64(log(Float64(l * h)) * -1.0)) ^ 0.5) * d));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[h, -1.05e-297], N[(N[(-1.0 * N[(d * t$95$1), $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], If[LessEqual[h, 6.8e-149], N[(t$95$1 * d), $MachinePrecision], If[LessEqual[h, 2.8e+171], N[(N[(t$95$0 * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] + N[(N[Power[N[(h / l), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$0 * N[Power[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] + N[(N[Power[N[Exp[N[(N[Log[N[(l * h), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\\
t_1 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\\
\mathbf{if}\;h \leq -1.05 \cdot 10^{-297}:\\
\;\;\;\;\left(-1 \cdot \left(d \cdot t\_1\right)\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\

\mathbf{elif}\;h \leq 6.8 \cdot 10^{-149}:\\
\;\;\;\;t\_1 \cdot d\\

\mathbf{elif}\;h \leq 2.8 \cdot 10^{+171}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, {\left(\frac{h}{{\ell}^{3}}\right)}^{0.5}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{0.5} \cdot d\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if h < -1.05000000000000007e-297

    1. Initial program 64.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      14. lower-*.f6471.0

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

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{\color{blue}{2}}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      16. metadata-eval71.0

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

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

    if -1.05000000000000007e-297 < h < 6.7999999999999998e-149

    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. Taylor expanded in d around inf

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      3. pow1/2N/A

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

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

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

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

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

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      10. lower-*.f6472.0

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      12. metadata-eval72.0

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d \]
    5. Applied rewrites72.0%

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

    if 6.7999999999999998e-149 < h < 2.80000000000000004e171

    1. Initial program 74.2%

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{2}}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      4. pow-powN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{\left(3 \cdot \frac{1}{2}\right)}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      7. metadata-eval74.0

        \[\leadsto \frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h} \]
    7. Applied rewrites74.0%

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

    if 2.80000000000000004e171 < h

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      3. pow-to-expN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      4. lower-exp.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      6. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      7. lift-*.f6466.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -1.05 \cdot 10^{-297}:\\ \;\;\;\;\left(-1 \cdot \left(d \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\right)\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{elif}\;h \leq 6.8 \cdot 10^{-149}:\\ \;\;\;\;{\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d\\ \mathbf{elif}\;h \leq 2.8 \cdot 10^{+171}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{0.5}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{0.5} \cdot d\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 63.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\ell \cdot h\right)}^{-1}\\ t_1 := -0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\\ t_2 := {t\_0}^{0.25}\\ \mathbf{if}\;h \leq -1.05 \cdot 10^{-297}:\\ \;\;\;\;\left(\left(-1 \cdot d\right) \cdot \left(t\_2 \cdot t\_2\right)\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{elif}\;h \leq 6.8 \cdot 10^{-149}:\\ \;\;\;\;{t\_0}^{0.5} \cdot d\\ \mathbf{elif}\;h \leq 2.8 \cdot 10^{+171}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_1, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, {\left(\frac{h}{{\ell}^{3}}\right)}^{0.5}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{0.5} \cdot d\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (* l h) -1.0))
        (t_1 (* -0.125 (/ (pow (* D M) 2.0) d)))
        (t_2 (pow t_0 0.25)))
   (if (<= h -1.05e-297)
     (*
      (* (* -1.0 d) (* t_2 t_2))
      (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
     (if (<= h 6.8e-149)
       (* (pow t_0 0.5) d)
       (if (<= h 2.8e+171)
         (/ (fma t_1 (pow (/ h l) 1.5) (* (pow (/ h l) 0.5) d)) h)
         (fma
          t_1
          (pow (/ h (pow l 3.0)) 0.5)
          (* (pow (exp (* (log (* l h)) -1.0)) 0.5) d)))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow((l * h), -1.0);
	double t_1 = -0.125 * (pow((D * M), 2.0) / d);
	double t_2 = pow(t_0, 0.25);
	double tmp;
	if (h <= -1.05e-297) {
		tmp = ((-1.0 * d) * (t_2 * t_2)) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	} else if (h <= 6.8e-149) {
		tmp = pow(t_0, 0.5) * d;
	} else if (h <= 2.8e+171) {
		tmp = fma(t_1, pow((h / l), 1.5), (pow((h / l), 0.5) * d)) / h;
	} else {
		tmp = fma(t_1, pow((h / pow(l, 3.0)), 0.5), (pow(exp((log((l * h)) * -1.0)), 0.5) * d));
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = Float64(l * h) ^ -1.0
	t_1 = Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d))
	t_2 = t_0 ^ 0.25
	tmp = 0.0
	if (h <= -1.05e-297)
		tmp = Float64(Float64(Float64(-1.0 * d) * Float64(t_2 * t_2)) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))));
	elseif (h <= 6.8e-149)
		tmp = Float64((t_0 ^ 0.5) * d);
	elseif (h <= 2.8e+171)
		tmp = Float64(fma(t_1, (Float64(h / l) ^ 1.5), Float64((Float64(h / l) ^ 0.5) * d)) / h);
	else
		tmp = fma(t_1, (Float64(h / (l ^ 3.0)) ^ 0.5), Float64((exp(Float64(log(Float64(l * h)) * -1.0)) ^ 0.5) * d));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$1 = N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$0, 0.25], $MachinePrecision]}, If[LessEqual[h, -1.05e-297], N[(N[(N[(-1.0 * d), $MachinePrecision] * N[(t$95$2 * t$95$2), $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], If[LessEqual[h, 6.8e-149], N[(N[Power[t$95$0, 0.5], $MachinePrecision] * d), $MachinePrecision], If[LessEqual[h, 2.8e+171], N[(N[(t$95$1 * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] + N[(N[Power[N[(h / l), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$1 * N[Power[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] + N[(N[Power[N[Exp[N[(N[Log[N[(l * h), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-1}\\
t_1 := -0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\\
t_2 := {t\_0}^{0.25}\\
\mathbf{if}\;h \leq -1.05 \cdot 10^{-297}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot \left(t\_2 \cdot t\_2\right)\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\

\mathbf{elif}\;h \leq 6.8 \cdot 10^{-149}:\\
\;\;\;\;{t\_0}^{0.5} \cdot d\\

\mathbf{elif}\;h \leq 2.8 \cdot 10^{+171}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, {\left(\frac{h}{{\ell}^{3}}\right)}^{0.5}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{0.5} \cdot d\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if h < -1.05000000000000007e-297

    1. Initial program 64.4%

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

        \[\leadsto \left({\color{blue}{\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. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\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) \]
      3. sqr-powN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left({\left(\frac{d}{h}\right)}^{\frac{1}{4}} \cdot \color{blue}{{\left(\frac{d}{h}\right)}^{\frac{1}{4}}}\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) \]
      14. lift-/.f6464.3

        \[\leadsto \left(\left({\left(\frac{d}{h}\right)}^{0.25} \cdot {\color{blue}{\left(\frac{d}{h}\right)}}^{0.25}\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) \]
    4. Applied rewrites64.3%

      \[\leadsto \left(\color{blue}{\left({\left(\frac{d}{h}\right)}^{0.25} \cdot {\left(\frac{d}{h}\right)}^{0.25}\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) \]
    5. Taylor expanded in h around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.05000000000000007e-297 < h < 6.7999999999999998e-149

    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. Taylor expanded in d around inf

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      3. pow1/2N/A

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

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

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

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

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

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      10. lower-*.f6472.0

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      12. metadata-eval72.0

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d \]
    5. Applied rewrites72.0%

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

    if 6.7999999999999998e-149 < h < 2.80000000000000004e171

    1. Initial program 74.2%

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{2}}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      4. pow-powN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{\left(3 \cdot \frac{1}{2}\right)}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      7. metadata-eval74.0

        \[\leadsto \frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h} \]
    7. Applied rewrites74.0%

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

    if 2.80000000000000004e171 < h

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      3. pow-to-expN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      4. lower-exp.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      6. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{{\ell}^{3}}\right)}^{\frac{1}{2}}, {\left(e^{\log \left(\ell \cdot h\right) \cdot -1}\right)}^{\frac{1}{2}} \cdot d\right) \]
      7. lift-*.f6466.3

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

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

Alternative 5: 60.7% accurate, N/A× speedup?

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

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

\mathbf{elif}\;d \leq 21000000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\

\mathbf{else}:\\
\;\;\;\;{\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d\\


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

    1. Initial program 74.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
      14. lower-*.f6473.5

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \]
    5. Applied rewrites73.5%

      \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
      6. inv-powN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}} \]
    7. Applied rewrites73.5%

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

    if -1.3e158 < d < 2.1e13

    1. Initial program 58.8%

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{2}}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      4. pow-powN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{\left(3 \cdot \frac{1}{2}\right)}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      7. metadata-eval65.6

        \[\leadsto \frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h} \]
    7. Applied rewrites65.6%

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

    if 2.1e13 < d

    1. Initial program 81.7%

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      3. pow1/2N/A

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

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

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

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

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

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      10. lower-*.f6463.4

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      12. metadata-eval63.4

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d \]
    5. Applied rewrites63.4%

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

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

Alternative 6: 56.6% accurate, N/A× speedup?

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

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

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


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

    1. Initial program 64.9%

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{2}}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      4. pow-powN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{\left(3 \cdot \frac{1}{2}\right)}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      7. metadata-eval63.8

        \[\leadsto \frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h} \]
    7. Applied rewrites63.8%

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

    if 1.08e-190 < l

    1. Initial program 68.8%

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

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

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

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

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

Alternative 7: 54.5% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{0.25}\\
\mathbf{if}\;d \leq -1.35 \cdot 10^{+54}:\\
\;\;\;\;-1 \cdot \left(d \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}}\right)\\

\mathbf{elif}\;d \leq 470000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, t\_0 \cdot t\_0, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\

\mathbf{else}:\\
\;\;\;\;{\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d\\


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

    1. Initial program 76.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
      14. lower-*.f6467.9

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{\color{blue}{2}}\right)} \]
      16. metadata-eval67.9

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \]
    5. Applied rewrites67.9%

      \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
      6. inv-powN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot \frac{1}{{\left(\ell \cdot h\right)}^{\left(\frac{\color{blue}{1}}{2}\right)}} \]
      17. metadata-eval68.0

        \[\leadsto \left(-1 \cdot d\right) \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}} \]
    7. Applied rewrites68.0%

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

    if -1.35000000000000005e54 < d < 4.7e11

    1. Initial program 55.1%

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{2}}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      4. sqr-powN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{4}} \cdot {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      7. lower-pow.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{4}} \cdot {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{4}}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      11. lower-pow.f64N/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{4}} \cdot {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{\frac{1}{4}}, {\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot d\right)}{h} \]
      13. lift-/.f6458.8

        \[\leadsto \frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{0.25} \cdot {\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{0.25}, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h} \]
    7. Applied rewrites58.8%

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

    if 4.7e11 < d

    1. Initial program 81.7%

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      3. pow1/2N/A

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

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

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

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

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

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      10. lower-*.f6463.4

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      12. metadata-eval63.4

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d \]
    5. Applied rewrites63.4%

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

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

Alternative 8: 52.2% accurate, N/A× speedup?

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

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

\mathbf{elif}\;d \leq 470000000000:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left({\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{0.5} \cdot \left(t\_0 \cdot t\_0\right), -0.125, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot \left(d \cdot d\right)\right)}{d}}{h}\\

\mathbf{else}:\\
\;\;\;\;{\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d\\


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

    1. Initial program 76.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
      14. lower-*.f6467.9

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{\color{blue}{2}}\right)} \]
      16. metadata-eval67.9

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \]
    5. Applied rewrites67.9%

      \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
      6. inv-powN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot \frac{1}{{\left(\ell \cdot h\right)}^{\left(\frac{\color{blue}{1}}{2}\right)}} \]
      17. metadata-eval68.0

        \[\leadsto \left(-1 \cdot d\right) \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}} \]
    7. Applied rewrites68.0%

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

    if -1.35000000000000005e54 < d < 4.7e11

    1. Initial program 55.1%

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

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

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

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

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

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

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

    if 4.7e11 < d

    1. Initial program 81.7%

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      3. pow1/2N/A

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

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

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

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

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

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      10. lower-*.f6463.4

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      12. metadata-eval63.4

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d \]
    5. Applied rewrites63.4%

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

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

Alternative 9: 43.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{d \cdot \left({\left(\frac{h}{\ell}\right)}^{0.5} \cdot -1\right)}{h}\\ \mathbf{if}\;h \leq -1.9 \cdot 10^{+259}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;h \leq -4 \cdot 10^{-309}:\\ \;\;\;\;-1 \cdot \left(d \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}}\right)\\ \mathbf{elif}\;h \leq 5.5 \cdot 10^{+130}:\\ \;\;\;\;{\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ (* d (* (pow (/ h l) 0.5) -1.0)) h)))
   (if (<= h -1.9e+259)
     t_0
     (if (<= h -4e-309)
       (* -1.0 (* d (/ 1.0 (pow (* l h) 0.5))))
       (if (<= h 5.5e+130) (* (pow (pow (* l h) -1.0) 0.5) d) t_0)))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = (d * (pow((h / l), 0.5) * -1.0)) / h;
	double tmp;
	if (h <= -1.9e+259) {
		tmp = t_0;
	} else if (h <= -4e-309) {
		tmp = -1.0 * (d * (1.0 / pow((l * h), 0.5)));
	} else if (h <= 5.5e+130) {
		tmp = pow(pow((l * h), -1.0), 0.5) * d;
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (d * (((h / l) ** 0.5d0) * (-1.0d0))) / h
    if (h <= (-1.9d+259)) then
        tmp = t_0
    else if (h <= (-4d-309)) then
        tmp = (-1.0d0) * (d * (1.0d0 / ((l * h) ** 0.5d0)))
    else if (h <= 5.5d+130) then
        tmp = (((l * h) ** (-1.0d0)) ** 0.5d0) * d
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = (d * (Math.pow((h / l), 0.5) * -1.0)) / h;
	double tmp;
	if (h <= -1.9e+259) {
		tmp = t_0;
	} else if (h <= -4e-309) {
		tmp = -1.0 * (d * (1.0 / Math.pow((l * h), 0.5)));
	} else if (h <= 5.5e+130) {
		tmp = Math.pow(Math.pow((l * h), -1.0), 0.5) * d;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = (d * (math.pow((h / l), 0.5) * -1.0)) / h
	tmp = 0
	if h <= -1.9e+259:
		tmp = t_0
	elif h <= -4e-309:
		tmp = -1.0 * (d * (1.0 / math.pow((l * h), 0.5)))
	elif h <= 5.5e+130:
		tmp = math.pow(math.pow((l * h), -1.0), 0.5) * d
	else:
		tmp = t_0
	return tmp
function code(d, h, l, M, D)
	t_0 = Float64(Float64(d * Float64((Float64(h / l) ^ 0.5) * -1.0)) / h)
	tmp = 0.0
	if (h <= -1.9e+259)
		tmp = t_0;
	elseif (h <= -4e-309)
		tmp = Float64(-1.0 * Float64(d * Float64(1.0 / (Float64(l * h) ^ 0.5))));
	elseif (h <= 5.5e+130)
		tmp = Float64(((Float64(l * h) ^ -1.0) ^ 0.5) * d);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = (d * (((h / l) ^ 0.5) * -1.0)) / h;
	tmp = 0.0;
	if (h <= -1.9e+259)
		tmp = t_0;
	elseif (h <= -4e-309)
		tmp = -1.0 * (d * (1.0 / ((l * h) ^ 0.5)));
	elseif (h <= 5.5e+130)
		tmp = (((l * h) ^ -1.0) ^ 0.5) * d;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(d * N[(N[Power[N[(h / l), $MachinePrecision], 0.5], $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[h, -1.9e+259], t$95$0, If[LessEqual[h, -4e-309], N[(-1.0 * N[(d * N[(1.0 / N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.5e+130], N[(N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{d \cdot \left({\left(\frac{h}{\ell}\right)}^{0.5} \cdot -1\right)}{h}\\
\mathbf{if}\;h \leq -1.9 \cdot 10^{+259}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;h \leq -4 \cdot 10^{-309}:\\
\;\;\;\;-1 \cdot \left(d \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}}\right)\\

\mathbf{elif}\;h \leq 5.5 \cdot 10^{+130}:\\
\;\;\;\;{\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -1.9e259 or 5.4999999999999997e130 < h

    1. Initial program 65.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{d \cdot \left(\sqrt{\frac{h}{\ell}} \cdot -1\right)}{h} \]
      8. pow1/2N/A

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

        \[\leadsto \frac{d \cdot \left({\left(\frac{h}{\ell}\right)}^{\frac{1}{2}} \cdot -1\right)}{h} \]
      10. lift-/.f6441.2

        \[\leadsto \frac{d \cdot \left({\left(\frac{h}{\ell}\right)}^{0.5} \cdot -1\right)}{h} \]
    8. Applied rewrites41.2%

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

    if -1.9e259 < h < -3.9999999999999977e-309

    1. Initial program 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
      14. lower-*.f6448.3

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{\color{blue}{2}}\right)} \]
      16. metadata-eval48.3

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \]
    5. Applied rewrites48.3%

      \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
      6. inv-powN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot \frac{1}{{\left(\ell \cdot h\right)}^{\left(\frac{\color{blue}{1}}{2}\right)}} \]
      17. metadata-eval48.3

        \[\leadsto \left(-1 \cdot d\right) \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}} \]
    7. Applied rewrites48.3%

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

    if -3.9999999999999977e-309 < h < 5.4999999999999997e130

    1. Initial program 72.2%

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      3. pow1/2N/A

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

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

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

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

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

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      10. lower-*.f6452.0

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      12. metadata-eval52.0

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d \]
    5. Applied rewrites52.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -1.9 \cdot 10^{+259}:\\ \;\;\;\;\frac{d \cdot \left({\left(\frac{h}{\ell}\right)}^{0.5} \cdot -1\right)}{h}\\ \mathbf{elif}\;h \leq -4 \cdot 10^{-309}:\\ \;\;\;\;-1 \cdot \left(d \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}}\right)\\ \mathbf{elif}\;h \leq 5.5 \cdot 10^{+130}:\\ \;\;\;\;{\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d\\ \mathbf{else}:\\ \;\;\;\;\frac{d \cdot \left({\left(\frac{h}{\ell}\right)}^{0.5} \cdot -1\right)}{h}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 42.2% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\\ \mathbf{if}\;d \leq 2.1 \cdot 10^{-228}:\\ \;\;\;\;-1 \cdot \left(d \cdot t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot d\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (pow (* l h) -1.0) 0.5)))
   (if (<= d 2.1e-228) (* -1.0 (* d t_0)) (* t_0 d))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow(pow((l * h), -1.0), 0.5);
	double tmp;
	if (d <= 2.1e-228) {
		tmp = -1.0 * (d * t_0);
	} else {
		tmp = t_0 * d;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
    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) ** (-1.0d0)) ** 0.5d0
    if (d <= 2.1d-228) then
        tmp = (-1.0d0) * (d * t_0)
    else
        tmp = t_0 * d
    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(Math.pow((l * h), -1.0), 0.5);
	double tmp;
	if (d <= 2.1e-228) {
		tmp = -1.0 * (d * t_0);
	} else {
		tmp = t_0 * d;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.pow(math.pow((l * h), -1.0), 0.5)
	tmp = 0
	if d <= 2.1e-228:
		tmp = -1.0 * (d * t_0)
	else:
		tmp = t_0 * d
	return tmp
function code(d, h, l, M, D)
	t_0 = (Float64(l * h) ^ -1.0) ^ 0.5
	tmp = 0.0
	if (d <= 2.1e-228)
		tmp = Float64(-1.0 * Float64(d * t_0));
	else
		tmp = Float64(t_0 * d);
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = ((l * h) ^ -1.0) ^ 0.5;
	tmp = 0.0;
	if (d <= 2.1e-228)
		tmp = -1.0 * (d * t_0);
	else
		tmp = t_0 * d;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[d, 2.1e-228], N[(-1.0 * N[(d * t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * d), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 60.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
      14. lower-*.f6443.3

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

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{\color{blue}{2}}\right)} \]
      16. metadata-eval43.3

        \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \]
    5. Applied rewrites43.3%

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

    if 2.09999999999999991e-228 < d

    1. Initial program 75.3%

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      3. pow1/2N/A

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

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

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

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

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

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

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

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

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \cdot d \]
      12. metadata-eval46.4

        \[\leadsto {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \cdot d \]
    5. Applied rewrites46.4%

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

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

Alternative 11: 27.3% accurate, N/A× speedup?

\[\begin{array}{l} \\ -1 \cdot \left(d \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\right) \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (* -1.0 (* d (pow (pow (* l h) -1.0) 0.5))))
double code(double d, double h, double l, double M, double D) {
	return -1.0 * (d * pow(pow((l * h), -1.0), 0.5));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
    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 = (-1.0d0) * (d * (((l * h) ** (-1.0d0)) ** 0.5d0))
end function
public static double code(double d, double h, double l, double M, double D) {
	return -1.0 * (d * Math.pow(Math.pow((l * h), -1.0), 0.5));
}
def code(d, h, l, M, D):
	return -1.0 * (d * math.pow(math.pow((l * h), -1.0), 0.5))
function code(d, h, l, M, D)
	return Float64(-1.0 * Float64(d * ((Float64(l * h) ^ -1.0) ^ 0.5)))
end
function tmp = code(d, h, l, M, D)
	tmp = -1.0 * (d * (((l * h) ^ -1.0) ^ 0.5));
end
code[d_, h_, l_, M_, D_] := N[(-1.0 * N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
-1 \cdot \left(d \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\right)
\end{array}
Derivation
  1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
    14. lower-*.f6428.8

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

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{\color{blue}{2}}\right)} \]
    16. metadata-eval28.8

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \]
  5. Applied rewrites28.8%

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

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

Alternative 12: 27.2% accurate, N/A× speedup?

\[\begin{array}{l} \\ -1 \cdot \left(d \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}}\right) \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (* -1.0 (* d (/ 1.0 (pow (* l h) 0.5)))))
double code(double d, double h, double l, double M, double D) {
	return -1.0 * (d * (1.0 / pow((l * h), 0.5)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
    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 = (-1.0d0) * (d * (1.0d0 / ((l * h) ** 0.5d0)))
end function
public static double code(double d, double h, double l, double M, double D) {
	return -1.0 * (d * (1.0 / Math.pow((l * h), 0.5)));
}
def code(d, h, l, M, D):
	return -1.0 * (d * (1.0 / math.pow((l * h), 0.5)))
function code(d, h, l, M, D)
	return Float64(-1.0 * Float64(d * Float64(1.0 / (Float64(l * h) ^ 0.5))))
end
function tmp = code(d, h, l, M, D)
	tmp = -1.0 * (d * (1.0 / ((l * h) ^ 0.5)));
end
code[d_, h_, l_, M_, D_] := N[(-1.0 * N[(d * N[(1.0 / N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
-1 \cdot \left(d \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}}\right)
\end{array}
Derivation
  1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
    14. lower-*.f6428.8

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

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{\color{blue}{2}}\right)} \]
    16. metadata-eval28.8

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \]
  5. Applied rewrites28.8%

    \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}} \]
  6. Step-by-step derivation
    1. metadata-evalN/A

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

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

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

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

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
    6. inv-powN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-1 \cdot d\right) \cdot \frac{1}{{\left(\ell \cdot h\right)}^{0.5}} \]
  7. Applied rewrites28.4%

    \[\leadsto \left(-1 \cdot d\right) \cdot \frac{1}{\color{blue}{{\left(\ell \cdot h\right)}^{0.5}}} \]
  8. Final simplification28.4%

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

Alternative 13: 26.2% accurate, N/A× speedup?

\[\begin{array}{l} \\ \left(-1 \cdot d\right) \cdot e^{\log \left({\left(\ell \cdot h\right)}^{-1}\right) \cdot 0.5} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (* (* -1.0 d) (exp (* (log (pow (* l h) -1.0)) 0.5))))
double code(double d, double h, double l, double M, double D) {
	return (-1.0 * d) * exp((log(pow((l * h), -1.0)) * 0.5));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
    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 = ((-1.0d0) * d) * exp((log(((l * h) ** (-1.0d0))) * 0.5d0))
end function
public static double code(double d, double h, double l, double M, double D) {
	return (-1.0 * d) * Math.exp((Math.log(Math.pow((l * h), -1.0)) * 0.5));
}
def code(d, h, l, M, D):
	return (-1.0 * d) * math.exp((math.log(math.pow((l * h), -1.0)) * 0.5))
function code(d, h, l, M, D)
	return Float64(Float64(-1.0 * d) * exp(Float64(log((Float64(l * h) ^ -1.0)) * 0.5)))
end
function tmp = code(d, h, l, M, D)
	tmp = (-1.0 * d) * exp((log(((l * h) ^ -1.0)) * 0.5));
end
code[d_, h_, l_, M_, D_] := N[(N[(-1.0 * d), $MachinePrecision] * N[Exp[N[(N[Log[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(-1 \cdot d\right) \cdot e^{\log \left({\left(\ell \cdot h\right)}^{-1}\right) \cdot 0.5}
\end{array}
Derivation
  1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{2}\right)} \]
    14. lower-*.f6428.8

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

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{\left(\frac{1}{\color{blue}{2}}\right)} \]
    16. metadata-eval28.8

      \[\leadsto \left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5} \]
  5. Applied rewrites28.8%

    \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}} \]
  6. Step-by-step derivation
    1. metadata-evalN/A

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

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

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

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

      \[\leadsto \left(-1 \cdot d\right) \cdot e^{\log \left({\left(\ell \cdot h\right)}^{-1}\right) \cdot \frac{1}{2}} \]
    6. lower-exp.f64N/A

      \[\leadsto \left(-1 \cdot d\right) \cdot e^{\log \left({\left(\ell \cdot h\right)}^{-1}\right) \cdot \frac{1}{2}} \]
    7. lower-*.f64N/A

      \[\leadsto \left(-1 \cdot d\right) \cdot e^{\log \left({\left(\ell \cdot h\right)}^{-1}\right) \cdot \frac{1}{2}} \]
    8. lower-log.f64N/A

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

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

      \[\leadsto \left(-1 \cdot d\right) \cdot e^{\log \left({\left(\ell \cdot h\right)}^{-1}\right) \cdot \frac{1}{2}} \]
    11. metadata-eval27.6

      \[\leadsto \left(-1 \cdot d\right) \cdot e^{\log \left({\left(\ell \cdot h\right)}^{-1}\right) \cdot 0.5} \]
  7. Applied rewrites27.6%

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

Reproduce

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