Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.0% → 91.3%
Time: 8.9s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \end{array} \]
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
	return c0 * sqrt((A / (V * l)));
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
	return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l)
	return Float64(c0 * sqrt(Float64(A / Float64(V * l))))
end
function tmp = code(c0, A, V, l)
	tmp = c0 * sqrt((A / (V * l)));
end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\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 10 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: 74.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \end{array} \]
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
	return c0 * sqrt((A / (V * l)));
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
	return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l)
	return Float64(c0 * sqrt(Float64(A / Float64(V * l))))
end
function tmp = code(c0, A, V, l)
	tmp = c0 * sqrt((A / (V * l)));
end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}

Alternative 1: 91.3% accurate, 0.3× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-201}:\\ \;\;\;\;c0 \cdot \frac{\frac{\sqrt{-A}}{\sqrt{-V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) -1e-201)
   (* c0 (/ (/ (sqrt (- A)) (sqrt (- V))) (sqrt l)))
   (if (<= (* V l) 0.0)
     (* c0 (pow (/ V (/ A l)) -0.5))
     (if (<= (* V l) 4e+301)
       (* c0 (/ (sqrt A) (sqrt (* V l))))
       (/ c0 (sqrt (/ l (/ A V))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -1e-201) {
		tmp = c0 * ((sqrt(-A) / sqrt(-V)) / sqrt(l));
	} else if ((V * l) <= 0.0) {
		tmp = c0 * pow((V / (A / l)), -0.5);
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 / sqrt((l / (A / V)));
	}
	return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if ((v * l) <= (-1d-201)) then
        tmp = c0 * ((sqrt(-a) / sqrt(-v)) / sqrt(l))
    else if ((v * l) <= 0.0d0) then
        tmp = c0 * ((v / (a / l)) ** (-0.5d0))
    else if ((v * l) <= 4d+301) then
        tmp = c0 * (sqrt(a) / sqrt((v * l)))
    else
        tmp = c0 / sqrt((l / (a / v)))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -1e-201) {
		tmp = c0 * ((Math.sqrt(-A) / Math.sqrt(-V)) / Math.sqrt(l));
	} else if ((V * l) <= 0.0) {
		tmp = c0 * Math.pow((V / (A / l)), -0.5);
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 / Math.sqrt((l / (A / V)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -1e-201:
		tmp = c0 * ((math.sqrt(-A) / math.sqrt(-V)) / math.sqrt(l))
	elif (V * l) <= 0.0:
		tmp = c0 * math.pow((V / (A / l)), -0.5)
	elif (V * l) <= 4e+301:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 / math.sqrt((l / (A / V)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= -1e-201)
		tmp = Float64(c0 * Float64(Float64(sqrt(Float64(-A)) / sqrt(Float64(-V))) / sqrt(l)));
	elseif (Float64(V * l) <= 0.0)
		tmp = Float64(c0 * (Float64(V / Float64(A / l)) ^ -0.5));
	elseif (Float64(V * l) <= 4e+301)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 / sqrt(Float64(l / Float64(A / V))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -1e-201)
		tmp = c0 * ((sqrt(-A) / sqrt(-V)) / sqrt(l));
	elseif ((V * l) <= 0.0)
		tmp = c0 * ((V / (A / l)) ^ -0.5);
	elseif ((V * l) <= 4e+301)
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 / sqrt((l / (A / V)));
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], -1e-201], N[(c0 * N[(N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[Power[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-201}:\\
\;\;\;\;c0 \cdot \frac{\frac{\sqrt{-A}}{\sqrt{-V}}}{\sqrt{\ell}}\\

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}\\

\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -9.99999999999999946e-202

    1. Initial program 77.9%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. associate-/r*73.9%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. sqrt-div41.8%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
    3. Applied egg-rr41.8%

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
    4. Step-by-step derivation
      1. frac-2neg41.8%

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\frac{-A}{-V}}}}{\sqrt{\ell}} \]
      2. sqrt-div51.2%

        \[\leadsto c0 \cdot \frac{\color{blue}{\frac{\sqrt{-A}}{\sqrt{-V}}}}{\sqrt{\ell}} \]
    5. Applied egg-rr51.2%

      \[\leadsto c0 \cdot \frac{\color{blue}{\frac{\sqrt{-A}}{\sqrt{-V}}}}{\sqrt{\ell}} \]

    if -9.99999999999999946e-202 < (*.f64 V l) < 0.0

    1. Initial program 72.6%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. pow1/272.6%

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{A}{V \cdot \ell}\right)}^{0.5}} \]
      2. clear-num72.6%

        \[\leadsto c0 \cdot {\color{blue}{\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)}}^{0.5} \]
      3. inv-pow72.6%

        \[\leadsto c0 \cdot {\color{blue}{\left({\left(\frac{V \cdot \ell}{A}\right)}^{-1}\right)}}^{0.5} \]
      4. pow-pow72.6%

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*75.8%

        \[\leadsto c0 \cdot {\color{blue}{\left(\frac{V}{\frac{A}{\ell}}\right)}}^{\left(-1 \cdot 0.5\right)} \]
      6. metadata-eval75.8%

        \[\leadsto c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{\color{blue}{-0.5}} \]
    3. Applied egg-rr75.8%

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]

    if 0.0 < (*.f64 V l) < 4.00000000000000021e301

    1. Initial program 90.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. sqrt-div99.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      2. associate-*r/97.8%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    3. Applied egg-rr97.8%

      \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    4. Step-by-step derivation
      1. *-commutative97.8%

        \[\leadsto \frac{\color{blue}{\sqrt{A} \cdot c0}}{\sqrt{V \cdot \ell}} \]
      2. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    5. Simplified99.5%

      \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]

    if 4.00000000000000021e301 < (*.f64 V l)

    1. Initial program 16.9%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac78.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr78.5%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. frac-times16.9%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}} \]
      2. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}} \]
      3. associate-/r*78.7%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-undiv39.0%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. associate-*r/39.1%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      6. associate-/l*39.0%

        \[\leadsto \color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}} \]
      7. sqrt-undiv78.7%

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
    5. Applied egg-rr78.7%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification75.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-201}:\\ \;\;\;\;c0 \cdot \frac{\frac{\sqrt{-A}}{\sqrt{-V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \]

Alternative 2: 91.0% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) (- INFINITY))
   (* c0 (* (pow (/ V A) -0.5) (pow l -0.5)))
   (if (<= (* V l) -5e-282)
     (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
     (if (<= (* V l) 5e-261)
       (* c0 (/ 1.0 (sqrt (/ V (/ A l)))))
       (if (<= (* V l) 4e+301)
         (* c0 (/ (sqrt A) (sqrt (* V l))))
         (/ c0 (sqrt (/ l (/ A V)))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 * (pow((V / A), -0.5) * pow(l, -0.5));
	} else if ((V * l) <= -5e-282) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 * (1.0 / sqrt((V / (A / l))));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 / sqrt((l / (A / V)));
	}
	return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = c0 * (Math.pow((V / A), -0.5) * Math.pow(l, -0.5));
	} else if ((V * l) <= -5e-282) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 * (1.0 / Math.sqrt((V / (A / l))));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 / Math.sqrt((l / (A / V)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = c0 * (math.pow((V / A), -0.5) * math.pow(l, -0.5))
	elif (V * l) <= -5e-282:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 5e-261:
		tmp = c0 * (1.0 / math.sqrt((V / (A / l))))
	elif (V * l) <= 4e+301:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 / math.sqrt((l / (A / V)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = Float64(c0 * Float64((Float64(V / A) ^ -0.5) * (l ^ -0.5)));
	elseif (Float64(V * l) <= -5e-282)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 5e-261)
		tmp = Float64(c0 * Float64(1.0 / sqrt(Float64(V / Float64(A / l)))));
	elseif (Float64(V * l) <= 4e+301)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 / sqrt(Float64(l / Float64(A / V))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = c0 * (((V / A) ^ -0.5) * (l ^ -0.5));
	elseif ((V * l) <= -5e-282)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 5e-261)
		tmp = c0 * (1.0 / sqrt((V / (A / l))));
	elseif ((V * l) <= 4e+301)
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 / sqrt((l / (A / V)));
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 * N[(N[Power[N[(V / A), $MachinePrecision], -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-282], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 * N[(1.0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)\\

\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\

\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\

\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 V l) < -inf.0

    1. Initial program 28.6%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity28.6%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac66.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr66.1%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. frac-times28.6%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}} \]
      2. *-un-lft-identity28.6%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}} \]
      3. associate-/l/66.2%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      4. clear-num66.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{V}{\frac{A}{\ell}}}}} \]
      5. unpow-166.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-1}}} \]
      6. sqrt-pow166.2%

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{\left(\frac{-1}{2}\right)}} \]
      7. associate-/r/66.2%

        \[\leadsto c0 \cdot {\color{blue}{\left(\frac{V}{A} \cdot \ell\right)}}^{\left(\frac{-1}{2}\right)} \]
      8. metadata-eval66.2%

        \[\leadsto c0 \cdot {\left(\frac{V}{A} \cdot \ell\right)}^{\color{blue}{-0.5}} \]
      9. unpow-prod-down33.9%

        \[\leadsto c0 \cdot \color{blue}{\left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)} \]
    5. Applied egg-rr33.9%

      \[\leadsto c0 \cdot \color{blue}{\left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)} \]

    if -inf.0 < (*.f64 V l) < -5.0000000000000001e-282

    1. Initial program 87.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. frac-2neg87.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{-A}{-V \cdot \ell}}} \]
      2. sqrt-div99.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{-V \cdot \ell}}} \]
      3. *-commutative99.5%

        \[\leadsto c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\color{blue}{\ell \cdot V}}} \]
      4. distribute-rgt-neg-in99.5%

        \[\leadsto c0 \cdot \frac{\sqrt{-A}}{\sqrt{\color{blue}{\ell \cdot \left(-V\right)}}} \]
    3. Applied egg-rr99.5%

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}} \]

    if -5.0000000000000001e-282 < (*.f64 V l) < 4.99999999999999981e-261

    1. Initial program 71.1%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. clear-num71.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{V \cdot \ell}{A}}}} \]
      2. sqrt-div71.1%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{V \cdot \ell}{A}}}} \]
      3. metadata-eval71.1%

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{V \cdot \ell}{A}}} \]
      4. associate-/l*77.1%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
    3. Applied egg-rr77.1%

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}} \]

    if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301

    1. Initial program 90.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. sqrt-div99.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      2. associate-*r/97.7%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    3. Applied egg-rr97.7%

      \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    4. Step-by-step derivation
      1. *-commutative97.7%

        \[\leadsto \frac{\color{blue}{\sqrt{A} \cdot c0}}{\sqrt{V \cdot \ell}} \]
      2. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    5. Simplified99.5%

      \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]

    if 4.00000000000000021e301 < (*.f64 V l)

    1. Initial program 16.9%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac78.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr78.5%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. frac-times16.9%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}} \]
      2. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}} \]
      3. associate-/r*78.7%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-undiv39.0%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. associate-*r/39.1%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      6. associate-/l*39.0%

        \[\leadsto \color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}} \]
      7. sqrt-undiv78.7%

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
    5. Applied egg-rr78.7%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification90.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \]

Alternative 3: 91.1% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{\sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) (- INFINITY))
   (* c0 (/ (sqrt (- (/ A l))) (sqrt (- V))))
   (if (<= (* V l) -5e-282)
     (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
     (if (<= (* V l) 5e-261)
       (* c0 (/ 1.0 (sqrt (/ V (/ A l)))))
       (if (<= (* V l) 4e+301)
         (* c0 (/ (sqrt A) (sqrt (* V l))))
         (/ c0 (sqrt (/ l (/ A V)))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 * (sqrt(-(A / l)) / sqrt(-V));
	} else if ((V * l) <= -5e-282) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 * (1.0 / sqrt((V / (A / l))));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 / sqrt((l / (A / V)));
	}
	return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = c0 * (Math.sqrt(-(A / l)) / Math.sqrt(-V));
	} else if ((V * l) <= -5e-282) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 * (1.0 / Math.sqrt((V / (A / l))));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 / Math.sqrt((l / (A / V)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = c0 * (math.sqrt(-(A / l)) / math.sqrt(-V))
	elif (V * l) <= -5e-282:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 5e-261:
		tmp = c0 * (1.0 / math.sqrt((V / (A / l))))
	elif (V * l) <= 4e+301:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 / math.sqrt((l / (A / V)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = Float64(c0 * Float64(sqrt(Float64(-Float64(A / l))) / sqrt(Float64(-V))));
	elseif (Float64(V * l) <= -5e-282)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 5e-261)
		tmp = Float64(c0 * Float64(1.0 / sqrt(Float64(V / Float64(A / l)))));
	elseif (Float64(V * l) <= 4e+301)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 / sqrt(Float64(l / Float64(A / V))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = c0 * (sqrt(-(A / l)) / sqrt(-V));
	elseif ((V * l) <= -5e-282)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 5e-261)
		tmp = c0 * (1.0 / sqrt((V / (A / l))));
	elseif ((V * l) <= 4e+301)
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 / sqrt((l / (A / V)));
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 * N[(N[Sqrt[(-N[(A / l), $MachinePrecision])], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-282], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 * N[(1.0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{\sqrt{-V}}\\

\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\

\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\

\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 V l) < -inf.0

    1. Initial program 28.6%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity28.6%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac66.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr66.1%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. associate-*l/66.2%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot \frac{A}{\ell}}{V}}} \]
      2. *-un-lft-identity66.2%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\frac{A}{\ell}}}{V}} \]
    5. Applied egg-rr66.2%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
    6. Step-by-step derivation
      1. frac-2neg66.2%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{-\frac{A}{\ell}}{-V}}} \]
      2. sqrt-div39.7%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-\frac{A}{\ell}}}{\sqrt{-V}}} \]
    7. Applied egg-rr39.7%

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-\frac{A}{\ell}}}{\sqrt{-V}}} \]
    8. Step-by-step derivation
      1. distribute-neg-frac39.7%

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\frac{-A}{\ell}}}}{\sqrt{-V}} \]
    9. Simplified39.7%

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}} \]

    if -inf.0 < (*.f64 V l) < -5.0000000000000001e-282

    1. Initial program 87.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. frac-2neg87.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{-A}{-V \cdot \ell}}} \]
      2. sqrt-div99.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{-V \cdot \ell}}} \]
      3. *-commutative99.5%

        \[\leadsto c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\color{blue}{\ell \cdot V}}} \]
      4. distribute-rgt-neg-in99.5%

        \[\leadsto c0 \cdot \frac{\sqrt{-A}}{\sqrt{\color{blue}{\ell \cdot \left(-V\right)}}} \]
    3. Applied egg-rr99.5%

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}} \]

    if -5.0000000000000001e-282 < (*.f64 V l) < 4.99999999999999981e-261

    1. Initial program 71.1%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. clear-num71.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{V \cdot \ell}{A}}}} \]
      2. sqrt-div71.1%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{V \cdot \ell}{A}}}} \]
      3. metadata-eval71.1%

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{V \cdot \ell}{A}}} \]
      4. associate-/l*77.1%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
    3. Applied egg-rr77.1%

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}} \]

    if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301

    1. Initial program 90.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. sqrt-div99.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      2. associate-*r/97.7%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    3. Applied egg-rr97.7%

      \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    4. Step-by-step derivation
      1. *-commutative97.7%

        \[\leadsto \frac{\color{blue}{\sqrt{A} \cdot c0}}{\sqrt{V \cdot \ell}} \]
      2. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    5. Simplified99.5%

      \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]

    if 4.00000000000000021e301 < (*.f64 V l)

    1. Initial program 16.9%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac78.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr78.5%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. frac-times16.9%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}} \]
      2. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}} \]
      3. associate-/r*78.7%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-undiv39.0%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. associate-*r/39.1%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      6. associate-/l*39.0%

        \[\leadsto \color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}} \]
      7. sqrt-undiv78.7%

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
    5. Applied egg-rr78.7%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification91.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{\sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \]

Alternative 4: 91.0% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\frac{-\ell}{A}}}{\sqrt{\frac{-1}{V}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) (- INFINITY))
   (/ c0 (/ (sqrt (/ (- l) A)) (sqrt (/ -1.0 V))))
   (if (<= (* V l) -5e-282)
     (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
     (if (<= (* V l) 5e-261)
       (* c0 (/ 1.0 (sqrt (/ V (/ A l)))))
       (if (<= (* V l) 4e+301)
         (* c0 (/ (sqrt A) (sqrt (* V l))))
         (/ c0 (sqrt (/ l (/ A V)))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 / (sqrt((-l / A)) / sqrt((-1.0 / V)));
	} else if ((V * l) <= -5e-282) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 * (1.0 / sqrt((V / (A / l))));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 / sqrt((l / (A / V)));
	}
	return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = c0 / (Math.sqrt((-l / A)) / Math.sqrt((-1.0 / V)));
	} else if ((V * l) <= -5e-282) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 * (1.0 / Math.sqrt((V / (A / l))));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 / Math.sqrt((l / (A / V)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = c0 / (math.sqrt((-l / A)) / math.sqrt((-1.0 / V)))
	elif (V * l) <= -5e-282:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 5e-261:
		tmp = c0 * (1.0 / math.sqrt((V / (A / l))))
	elif (V * l) <= 4e+301:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 / math.sqrt((l / (A / V)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = Float64(c0 / Float64(sqrt(Float64(Float64(-l) / A)) / sqrt(Float64(-1.0 / V))));
	elseif (Float64(V * l) <= -5e-282)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 5e-261)
		tmp = Float64(c0 * Float64(1.0 / sqrt(Float64(V / Float64(A / l)))));
	elseif (Float64(V * l) <= 4e+301)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 / sqrt(Float64(l / Float64(A / V))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = c0 / (sqrt((-l / A)) / sqrt((-1.0 / V)));
	elseif ((V * l) <= -5e-282)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 5e-261)
		tmp = c0 * (1.0 / sqrt((V / (A / l))));
	elseif ((V * l) <= 4e+301)
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 / sqrt((l / (A / V)));
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 / N[(N[Sqrt[N[((-l) / A), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(-1.0 / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-282], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 * N[(1.0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\frac{-\ell}{A}}}{\sqrt{\frac{-1}{V}}}}\\

\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\

\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\

\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 V l) < -inf.0

    1. Initial program 28.6%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity28.6%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac66.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr66.1%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt31.9%

        \[\leadsto \color{blue}{\left(\sqrt{c0} \cdot \sqrt{c0}\right)} \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \]
      2. sqrt-prod40.5%

        \[\leadsto \color{blue}{\sqrt{c0 \cdot c0}} \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \]
      3. sqrt-prod28.2%

        \[\leadsto \color{blue}{\sqrt{\left(c0 \cdot c0\right) \cdot \left(\frac{1}{V} \cdot \frac{A}{\ell}\right)}} \]
      4. *-commutative28.2%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{1}{V} \cdot \frac{A}{\ell}\right) \cdot \left(c0 \cdot c0\right)}} \]
      5. frac-times28.2%

        \[\leadsto \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      6. *-un-lft-identity28.2%

        \[\leadsto \sqrt{\frac{\color{blue}{A}}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)} \]
      7. expm1-log1p-u28.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{A}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)}\right)\right)} \]
      8. expm1-udef28.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{A}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)}\right)} - 1} \]
    5. Applied egg-rr28.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\right)} - 1} \]
    6. Step-by-step derivation
      1. expm1-def59.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\right)\right)} \]
      2. expm1-log1p66.1%

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      3. associate-/r/66.1%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
      4. *-commutative66.1%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{V \cdot \frac{\ell}{A}}}} \]
    7. Simplified66.1%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    8. Step-by-step derivation
      1. pow166.1%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{{V}^{1}} \cdot \frac{\ell}{A}}} \]
      2. metadata-eval66.1%

        \[\leadsto \frac{c0}{\sqrt{{V}^{\color{blue}{\left(--1\right)}} \cdot \frac{\ell}{A}}} \]
      3. pow-flip66.1%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{1}{{V}^{-1}}} \cdot \frac{\ell}{A}}} \]
      4. inv-pow66.1%

        \[\leadsto \frac{c0}{\sqrt{\frac{1}{\color{blue}{\frac{1}{V}}} \cdot \frac{\ell}{A}}} \]
      5. times-frac66.1%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{1 \cdot \ell}{\frac{1}{V} \cdot A}}}} \]
      6. *-un-lft-identity66.1%

        \[\leadsto \frac{c0}{\sqrt{\frac{\color{blue}{\ell}}{\frac{1}{V} \cdot A}}} \]
      7. associate-/l/66.1%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\frac{\ell}{A}}{\frac{1}{V}}}}} \]
      8. frac-2neg66.1%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{-\frac{\ell}{A}}{-\frac{1}{V}}}}} \]
      9. sqrt-div39.7%

        \[\leadsto \frac{c0}{\color{blue}{\frac{\sqrt{-\frac{\ell}{A}}}{\sqrt{-\frac{1}{V}}}}} \]
    9. Applied egg-rr39.7%

      \[\leadsto \frac{c0}{\color{blue}{\frac{\sqrt{-\frac{\ell}{A}}}{\sqrt{-\frac{1}{V}}}}} \]
    10. Step-by-step derivation
      1. distribute-neg-frac39.7%

        \[\leadsto \frac{c0}{\frac{\sqrt{\color{blue}{\frac{-\ell}{A}}}}{\sqrt{-\frac{1}{V}}}} \]
      2. distribute-neg-frac39.7%

        \[\leadsto \frac{c0}{\frac{\sqrt{\frac{-\ell}{A}}}{\sqrt{\color{blue}{\frac{-1}{V}}}}} \]
      3. metadata-eval39.7%

        \[\leadsto \frac{c0}{\frac{\sqrt{\frac{-\ell}{A}}}{\sqrt{\frac{\color{blue}{-1}}{V}}}} \]
    11. Simplified39.7%

      \[\leadsto \frac{c0}{\color{blue}{\frac{\sqrt{\frac{-\ell}{A}}}{\sqrt{\frac{-1}{V}}}}} \]

    if -inf.0 < (*.f64 V l) < -5.0000000000000001e-282

    1. Initial program 87.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. frac-2neg87.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{-A}{-V \cdot \ell}}} \]
      2. sqrt-div99.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{-V \cdot \ell}}} \]
      3. *-commutative99.5%

        \[\leadsto c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\color{blue}{\ell \cdot V}}} \]
      4. distribute-rgt-neg-in99.5%

        \[\leadsto c0 \cdot \frac{\sqrt{-A}}{\sqrt{\color{blue}{\ell \cdot \left(-V\right)}}} \]
    3. Applied egg-rr99.5%

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}} \]

    if -5.0000000000000001e-282 < (*.f64 V l) < 4.99999999999999981e-261

    1. Initial program 71.1%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. clear-num71.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{V \cdot \ell}{A}}}} \]
      2. sqrt-div71.1%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{V \cdot \ell}{A}}}} \]
      3. metadata-eval71.1%

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{V \cdot \ell}{A}}} \]
      4. associate-/l*77.1%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
    3. Applied egg-rr77.1%

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}} \]

    if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301

    1. Initial program 90.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. sqrt-div99.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      2. associate-*r/97.7%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    3. Applied egg-rr97.7%

      \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    4. Step-by-step derivation
      1. *-commutative97.7%

        \[\leadsto \frac{\color{blue}{\sqrt{A} \cdot c0}}{\sqrt{V \cdot \ell}} \]
      2. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    5. Simplified99.5%

      \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]

    if 4.00000000000000021e301 < (*.f64 V l)

    1. Initial program 16.9%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac78.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr78.5%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. frac-times16.9%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}} \]
      2. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}} \]
      3. associate-/r*78.7%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-undiv39.0%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. associate-*r/39.1%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      6. associate-/l*39.0%

        \[\leadsto \color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}} \]
      7. sqrt-undiv78.7%

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
    5. Applied egg-rr78.7%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification91.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\frac{-\ell}{A}}}{\sqrt{\frac{-1}{V}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \]

Alternative 5: 83.4% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+263}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) -2e+263)
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (if (<= (* V l) 5e-261)
     (/ c0 (sqrt (/ (* V l) A)))
     (if (<= (* V l) 4e+301)
       (* c0 (/ (sqrt A) (sqrt (* V l))))
       (/ c0 (sqrt (/ l (/ A V))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -2e+263) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 / sqrt(((V * l) / A));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 / sqrt((l / (A / V)));
	}
	return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if ((v * l) <= (-2d+263)) then
        tmp = c0 * (sqrt((a / v)) / sqrt(l))
    else if ((v * l) <= 5d-261) then
        tmp = c0 / sqrt(((v * l) / a))
    else if ((v * l) <= 4d+301) then
        tmp = c0 * (sqrt(a) / sqrt((v * l)))
    else
        tmp = c0 / sqrt((l / (a / v)))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -2e+263) {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 / Math.sqrt(((V * l) / A));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 / Math.sqrt((l / (A / V)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -2e+263:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	elif (V * l) <= 5e-261:
		tmp = c0 / math.sqrt(((V * l) / A))
	elif (V * l) <= 4e+301:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 / math.sqrt((l / (A / V)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= -2e+263)
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	elseif (Float64(V * l) <= 5e-261)
		tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A)));
	elseif (Float64(V * l) <= 4e+301)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 / sqrt(Float64(l / Float64(A / V))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -2e+263)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	elseif ((V * l) <= 5e-261)
		tmp = c0 / sqrt(((V * l) / A));
	elseif ((V * l) <= 4e+301)
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 / sqrt((l / (A / V)));
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], -2e+263], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+263}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\

\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -2.00000000000000003e263

    1. Initial program 38.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. associate-/r*68.2%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. sqrt-div37.2%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
    3. Applied egg-rr37.2%

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]

    if -2.00000000000000003e263 < (*.f64 V l) < 4.99999999999999981e-261

    1. Initial program 83.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity83.0%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac74.9%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr74.9%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt34.3%

        \[\leadsto \color{blue}{\left(\sqrt{c0} \cdot \sqrt{c0}\right)} \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \]
      2. sqrt-prod29.5%

        \[\leadsto \color{blue}{\sqrt{c0 \cdot c0}} \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \]
      3. sqrt-prod27.8%

        \[\leadsto \color{blue}{\sqrt{\left(c0 \cdot c0\right) \cdot \left(\frac{1}{V} \cdot \frac{A}{\ell}\right)}} \]
      4. *-commutative27.8%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{1}{V} \cdot \frac{A}{\ell}\right) \cdot \left(c0 \cdot c0\right)}} \]
      5. frac-times30.7%

        \[\leadsto \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      6. *-un-lft-identity30.7%

        \[\leadsto \sqrt{\frac{\color{blue}{A}}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)} \]
      7. expm1-log1p-u30.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{A}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)}\right)\right)} \]
      8. expm1-udef23.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{A}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)}\right)} - 1} \]
    5. Applied egg-rr30.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\right)} - 1} \]
    6. Step-by-step derivation
      1. expm1-def47.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\right)\right)} \]
      2. expm1-log1p77.0%

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      3. associate-/r/74.6%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
      4. *-commutative74.6%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{V \cdot \frac{\ell}{A}}}} \]
    7. Simplified74.6%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    8. Taylor expanded in V around 0 83.1%

      \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V \cdot \ell}{A}}}} \]

    if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301

    1. Initial program 90.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. sqrt-div99.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      2. associate-*r/97.7%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    3. Applied egg-rr97.7%

      \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    4. Step-by-step derivation
      1. *-commutative97.7%

        \[\leadsto \frac{\color{blue}{\sqrt{A} \cdot c0}}{\sqrt{V \cdot \ell}} \]
      2. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    5. Simplified99.5%

      \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]

    if 4.00000000000000021e301 < (*.f64 V l)

    1. Initial program 16.9%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac78.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr78.5%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. frac-times16.9%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}} \]
      2. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}} \]
      3. associate-/r*78.7%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-undiv39.0%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. associate-*r/39.1%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      6. associate-/l*39.0%

        \[\leadsto \color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}} \]
      7. sqrt-undiv78.7%

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
    5. Applied egg-rr78.7%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+263}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \]

Alternative 6: 83.2% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+307}:\\ \;\;\;\;c0 \cdot \left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) -5e+307)
   (* c0 (* (pow (/ V A) -0.5) (pow l -0.5)))
   (if (<= (* V l) 5e-261)
     (/ c0 (sqrt (/ (* V l) A)))
     (if (<= (* V l) 4e+301)
       (* c0 (/ (sqrt A) (sqrt (* V l))))
       (/ c0 (sqrt (/ l (/ A V))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -5e+307) {
		tmp = c0 * (pow((V / A), -0.5) * pow(l, -0.5));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 / sqrt(((V * l) / A));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 / sqrt((l / (A / V)));
	}
	return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if ((v * l) <= (-5d+307)) then
        tmp = c0 * (((v / a) ** (-0.5d0)) * (l ** (-0.5d0)))
    else if ((v * l) <= 5d-261) then
        tmp = c0 / sqrt(((v * l) / a))
    else if ((v * l) <= 4d+301) then
        tmp = c0 * (sqrt(a) / sqrt((v * l)))
    else
        tmp = c0 / sqrt((l / (a / v)))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -5e+307) {
		tmp = c0 * (Math.pow((V / A), -0.5) * Math.pow(l, -0.5));
	} else if ((V * l) <= 5e-261) {
		tmp = c0 / Math.sqrt(((V * l) / A));
	} else if ((V * l) <= 4e+301) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 / Math.sqrt((l / (A / V)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -5e+307:
		tmp = c0 * (math.pow((V / A), -0.5) * math.pow(l, -0.5))
	elif (V * l) <= 5e-261:
		tmp = c0 / math.sqrt(((V * l) / A))
	elif (V * l) <= 4e+301:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 / math.sqrt((l / (A / V)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= -5e+307)
		tmp = Float64(c0 * Float64((Float64(V / A) ^ -0.5) * (l ^ -0.5)));
	elseif (Float64(V * l) <= 5e-261)
		tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A)));
	elseif (Float64(V * l) <= 4e+301)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 / sqrt(Float64(l / Float64(A / V))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -5e+307)
		tmp = c0 * (((V / A) ^ -0.5) * (l ^ -0.5));
	elseif ((V * l) <= 5e-261)
		tmp = c0 / sqrt(((V * l) / A));
	elseif ((V * l) <= 4e+301)
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 / sqrt((l / (A / V)));
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], -5e+307], N[(c0 * N[(N[Power[N[(V / A), $MachinePrecision], -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+307}:\\
\;\;\;\;c0 \cdot \left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)\\

\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\

\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -5e307

    1. Initial program 27.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity27.0%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac62.2%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr62.2%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. frac-times27.0%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}} \]
      2. *-un-lft-identity27.0%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}} \]
      3. associate-/l/62.3%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      4. clear-num62.2%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{V}{\frac{A}{\ell}}}}} \]
      5. unpow-162.2%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-1}}} \]
      6. sqrt-pow162.3%

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{\left(\frac{-1}{2}\right)}} \]
      7. associate-/r/62.3%

        \[\leadsto c0 \cdot {\color{blue}{\left(\frac{V}{A} \cdot \ell\right)}}^{\left(\frac{-1}{2}\right)} \]
      8. metadata-eval62.3%

        \[\leadsto c0 \cdot {\left(\frac{V}{A} \cdot \ell\right)}^{\color{blue}{-0.5}} \]
      9. unpow-prod-down31.8%

        \[\leadsto c0 \cdot \color{blue}{\left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)} \]
    5. Applied egg-rr31.8%

      \[\leadsto c0 \cdot \color{blue}{\left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)} \]

    if -5e307 < (*.f64 V l) < 4.99999999999999981e-261

    1. Initial program 83.4%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity83.4%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac75.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr75.5%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt35.1%

        \[\leadsto \color{blue}{\left(\sqrt{c0} \cdot \sqrt{c0}\right)} \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \]
      2. sqrt-prod30.4%

        \[\leadsto \color{blue}{\sqrt{c0 \cdot c0}} \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \]
      3. sqrt-prod28.1%

        \[\leadsto \color{blue}{\sqrt{\left(c0 \cdot c0\right) \cdot \left(\frac{1}{V} \cdot \frac{A}{\ell}\right)}} \]
      4. *-commutative28.1%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{1}{V} \cdot \frac{A}{\ell}\right) \cdot \left(c0 \cdot c0\right)}} \]
      5. frac-times30.9%

        \[\leadsto \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      6. *-un-lft-identity30.9%

        \[\leadsto \sqrt{\frac{\color{blue}{A}}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)} \]
      7. expm1-log1p-u30.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{A}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)}\right)\right)} \]
      8. expm1-udef24.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{A}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)}\right)} - 1} \]
    5. Applied egg-rr31.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\right)} - 1} \]
    6. Step-by-step derivation
      1. expm1-def49.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\right)\right)} \]
      2. expm1-log1p77.6%

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      3. associate-/r/75.2%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
      4. *-commutative75.2%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{V \cdot \frac{\ell}{A}}}} \]
    7. Simplified75.2%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    8. Taylor expanded in V around 0 83.4%

      \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V \cdot \ell}{A}}}} \]

    if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301

    1. Initial program 90.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. sqrt-div99.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      2. associate-*r/97.7%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    3. Applied egg-rr97.7%

      \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    4. Step-by-step derivation
      1. *-commutative97.7%

        \[\leadsto \frac{\color{blue}{\sqrt{A} \cdot c0}}{\sqrt{V \cdot \ell}} \]
      2. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    5. Simplified99.5%

      \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]

    if 4.00000000000000021e301 < (*.f64 V l)

    1. Initial program 16.9%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac78.5%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr78.5%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. frac-times16.9%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}} \]
      2. *-un-lft-identity16.9%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}} \]
      3. associate-/r*78.7%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-undiv39.0%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. associate-*r/39.1%

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      6. associate-/l*39.0%

        \[\leadsto \color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}} \]
      7. sqrt-undiv78.7%

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
    5. Applied egg-rr78.7%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+307}:\\ \;\;\;\;c0 \cdot \left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \end{array} \]

Alternative 7: 78.1% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+263}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+55}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) -2e+263)
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (if (<= (* V l) 5e+55)
     (/ c0 (sqrt (/ (* V l) A)))
     (* c0 (sqrt (/ (/ A l) V))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -2e+263) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else if ((V * l) <= 5e+55) {
		tmp = c0 / sqrt(((V * l) / A));
	} else {
		tmp = c0 * sqrt(((A / l) / V));
	}
	return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if ((v * l) <= (-2d+263)) then
        tmp = c0 * (sqrt((a / v)) / sqrt(l))
    else if ((v * l) <= 5d+55) then
        tmp = c0 / sqrt(((v * l) / a))
    else
        tmp = c0 * sqrt(((a / l) / v))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -2e+263) {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else if ((V * l) <= 5e+55) {
		tmp = c0 / Math.sqrt(((V * l) / A));
	} else {
		tmp = c0 * Math.sqrt(((A / l) / V));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -2e+263:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	elif (V * l) <= 5e+55:
		tmp = c0 / math.sqrt(((V * l) / A))
	else:
		tmp = c0 * math.sqrt(((A / l) / V))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= -2e+263)
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	elseif (Float64(V * l) <= 5e+55)
		tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A)));
	else
		tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V)));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -2e+263)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	elseif ((V * l) <= 5e+55)
		tmp = c0 / sqrt(((V * l) / A));
	else
		tmp = c0 * sqrt(((A / l) / V));
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], -2e+263], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+55], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+263}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+55}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 V l) < -2.00000000000000003e263

    1. Initial program 38.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. associate-/r*68.2%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. sqrt-div37.2%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
    3. Applied egg-rr37.2%

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]

    if -2.00000000000000003e263 < (*.f64 V l) < 5.00000000000000046e55

    1. Initial program 85.3%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity85.3%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac78.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr78.1%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt36.9%

        \[\leadsto \color{blue}{\left(\sqrt{c0} \cdot \sqrt{c0}\right)} \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \]
      2. sqrt-prod29.4%

        \[\leadsto \color{blue}{\sqrt{c0 \cdot c0}} \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \]
      3. sqrt-prod27.3%

        \[\leadsto \color{blue}{\sqrt{\left(c0 \cdot c0\right) \cdot \left(\frac{1}{V} \cdot \frac{A}{\ell}\right)}} \]
      4. *-commutative27.3%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{1}{V} \cdot \frac{A}{\ell}\right) \cdot \left(c0 \cdot c0\right)}} \]
      5. frac-times29.3%

        \[\leadsto \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      6. *-un-lft-identity29.3%

        \[\leadsto \sqrt{\frac{\color{blue}{A}}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)} \]
      7. expm1-log1p-u28.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{A}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)}\right)\right)} \]
      8. expm1-udef22.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{A}{V \cdot \ell} \cdot \left(c0 \cdot c0\right)}\right)} - 1} \]
    5. Applied egg-rr28.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\right)} - 1} \]
    6. Step-by-step derivation
      1. expm1-def47.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\right)\right)} \]
      2. expm1-log1p76.0%

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      3. associate-/r/78.0%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
      4. *-commutative78.0%

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{V \cdot \frac{\ell}{A}}}} \]
    7. Simplified78.0%

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    8. Taylor expanded in V around 0 85.3%

      \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V \cdot \ell}{A}}}} \]

    if 5.00000000000000046e55 < (*.f64 V l)

    1. Initial program 64.7%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity64.7%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac86.0%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr86.0%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. associate-*l/86.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot \frac{A}{\ell}}{V}}} \]
      2. *-un-lft-identity86.1%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\frac{A}{\ell}}}{V}} \]
    5. Applied egg-rr86.1%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+263}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+55}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \end{array} \]

Alternative 8: 77.3% accurate, 0.9× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (/ A (* V l))))
   (if (<= t_0 0.0) (* c0 (pow (* V (/ l A)) -0.5)) (* c0 (sqrt t_0)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = c0 * pow((V * (l / A)), -0.5);
	} else {
		tmp = c0 * sqrt(t_0);
	}
	return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: tmp
    t_0 = a / (v * l)
    if (t_0 <= 0.0d0) then
        tmp = c0 * ((v * (l / a)) ** (-0.5d0))
    else
        tmp = c0 * sqrt(t_0)
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = c0 * Math.pow((V * (l / A)), -0.5);
	} else {
		tmp = c0 * Math.sqrt(t_0);
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	t_0 = A / (V * l)
	tmp = 0
	if t_0 <= 0.0:
		tmp = c0 * math.pow((V * (l / A)), -0.5)
	else:
		tmp = c0 * math.sqrt(t_0)
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	t_0 = Float64(A / Float64(V * l))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = Float64(c0 * (Float64(V * Float64(l / A)) ^ -0.5));
	else
		tmp = Float64(c0 * sqrt(t_0));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	t_0 = A / (V * l);
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = c0 * ((V * (l / A)) ^ -0.5);
	else
		tmp = c0 * sqrt(t_0);
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Power[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 A (*.f64 V l)) < 0.0

    1. Initial program 25.4%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. pow1/225.4%

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{A}{V \cdot \ell}\right)}^{0.5}} \]
      2. clear-num25.4%

        \[\leadsto c0 \cdot {\color{blue}{\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)}}^{0.5} \]
      3. inv-pow25.4%

        \[\leadsto c0 \cdot {\color{blue}{\left({\left(\frac{V \cdot \ell}{A}\right)}^{-1}\right)}}^{0.5} \]
      4. pow-pow25.4%

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*65.3%

        \[\leadsto c0 \cdot {\color{blue}{\left(\frac{V}{\frac{A}{\ell}}\right)}}^{\left(-1 \cdot 0.5\right)} \]
      6. metadata-eval65.3%

        \[\leadsto c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{\color{blue}{-0.5}} \]
    3. Applied egg-rr65.3%

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. associate-/l*25.4%

        \[\leadsto c0 \cdot {\color{blue}{\left(\frac{V \cdot \ell}{A}\right)}}^{-0.5} \]
      2. *-lft-identity25.4%

        \[\leadsto c0 \cdot {\left(\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}\right)}^{-0.5} \]
      3. times-frac65.3%

        \[\leadsto c0 \cdot {\color{blue}{\left(\frac{V}{1} \cdot \frac{\ell}{A}\right)}}^{-0.5} \]
      4. /-rgt-identity65.3%

        \[\leadsto c0 \cdot {\left(\color{blue}{V} \cdot \frac{\ell}{A}\right)}^{-0.5} \]
    5. Simplified65.3%

      \[\leadsto c0 \cdot \color{blue}{{\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}} \]

    if 0.0 < (/.f64 A (*.f64 V l))

    1. Initial program 87.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{A}{V \cdot \ell} \leq 0:\\ \;\;\;\;c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \end{array} \]

Alternative 9: 77.4% accurate, 0.9× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (/ A (* V l))))
   (if (<= t_0 0.0) (* c0 (sqrt (/ (/ A l) V))) (* c0 (sqrt t_0)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = c0 * sqrt(((A / l) / V));
	} else {
		tmp = c0 * sqrt(t_0);
	}
	return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: tmp
    t_0 = a / (v * l)
    if (t_0 <= 0.0d0) then
        tmp = c0 * sqrt(((a / l) / v))
    else
        tmp = c0 * sqrt(t_0)
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = c0 * Math.sqrt(((A / l) / V));
	} else {
		tmp = c0 * Math.sqrt(t_0);
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	t_0 = A / (V * l)
	tmp = 0
	if t_0 <= 0.0:
		tmp = c0 * math.sqrt(((A / l) / V))
	else:
		tmp = c0 * math.sqrt(t_0)
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	t_0 = Float64(A / Float64(V * l))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V)));
	else
		tmp = Float64(c0 * sqrt(t_0));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	t_0 = A / (V * l);
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = c0 * sqrt(((A / l) / V));
	else
		tmp = c0 * sqrt(t_0);
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 A (*.f64 V l)) < 0.0

    1. Initial program 25.4%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity25.4%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
      2. times-frac65.2%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    3. Applied egg-rr65.2%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
    4. Step-by-step derivation
      1. associate-*l/65.3%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot \frac{A}{\ell}}{V}}} \]
      2. *-un-lft-identity65.3%

        \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\frac{A}{\ell}}}{V}} \]
    5. Applied egg-rr65.3%

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]

    if 0.0 < (/.f64 A (*.f64 V l))

    1. Initial program 87.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{A}{V \cdot \ell} \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \end{array} \]

Alternative 10: 74.0% accurate, 1.0× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	return c0 * sqrt((A / (V * l)));
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    code = c0 * sqrt((a / (v * l)))
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	return c0 * Math.sqrt((A / (V * l)));
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
V, l = sort([V, l])
function code(c0, A, V, l)
	return Float64(c0 * sqrt(Float64(A / Float64(V * l))))
end
V, l = num2cell(sort([V, l])){:}
function tmp = code(c0, A, V, l)
	tmp = c0 * sqrt((A / (V * l)));
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Derivation
  1. Initial program 77.6%

    \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
  2. Final simplification77.6%

    \[\leadsto c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

Reproduce

?
herbie shell --seed 2023254 
(FPCore (c0 A V l)
  :name "Henrywood and Agarwal, Equation (3)"
  :precision binary64
  (* c0 (sqrt (/ A (* V l)))))