Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.4% → 90.0%
Time: 8.4s
Alternatives: 12
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 12 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.4% 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: 90.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 \frac{1}{\frac{\sqrt{-V}}{\sqrt{\frac{-A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-306}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-317}:\\ \;\;\;\;c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot {\left(\frac{-1}{V}\right)}^{0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\ \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 (/ 1.0 (/ (sqrt (- V)) (sqrt (/ (- A) l)))))
   (if (<= (* V l) -5e-306)
     (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
     (if (<= (* V l) 1e-317)
       (* c0 (* (pow (/ (- l) A) -0.5) (pow (/ -1.0 V) 0.5)))
       (* c0 (* (sqrt A) (pow (* V l) -0.5)))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 * (1.0 / (sqrt(-V) / sqrt((-A / l))));
	} else if ((V * l) <= -5e-306) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 1e-317) {
		tmp = c0 * (pow((-l / A), -0.5) * pow((-1.0 / V), 0.5));
	} else {
		tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
	}
	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 * (1.0 / (Math.sqrt(-V) / Math.sqrt((-A / l))));
	} else if ((V * l) <= -5e-306) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 1e-317) {
		tmp = c0 * (Math.pow((-l / A), -0.5) * Math.pow((-1.0 / V), 0.5));
	} else {
		tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = c0 * (1.0 / (math.sqrt(-V) / math.sqrt((-A / l))))
	elif (V * l) <= -5e-306:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 1e-317:
		tmp = c0 * (math.pow((-l / A), -0.5) * math.pow((-1.0 / V), 0.5))
	else:
		tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5))
	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(1.0 / Float64(sqrt(Float64(-V)) / sqrt(Float64(Float64(-A) / l)))));
	elseif (Float64(V * l) <= -5e-306)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 1e-317)
		tmp = Float64(c0 * Float64((Float64(Float64(-l) / A) ^ -0.5) * (Float64(-1.0 / V) ^ 0.5)));
	else
		tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5)));
	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 * (1.0 / (sqrt(-V) / sqrt((-A / l))));
	elseif ((V * l) <= -5e-306)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 1e-317)
		tmp = c0 * (((-l / A) ^ -0.5) * ((-1.0 / V) ^ 0.5));
	else
		tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
	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[(1.0 / N[(N[Sqrt[(-V)], $MachinePrecision] / N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-306], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e-317], N[(c0 * N[(N[Power[N[((-l) / A), $MachinePrecision], -0.5], $MachinePrecision] * N[Power[N[(-1.0 / V), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $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{1}{\frac{\sqrt{-V}}{\sqrt{\frac{-A}{\ell}}}}\\

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

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\


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

    1. Initial program 16.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -4.99999999999999998e-306

    1. Initial program 84.8%

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

        \[\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 -4.99999999999999998e-306 < (*.f64 V l) < 1.00000023e-317

    1. Initial program 38.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}} \]
    6. Taylor expanded in V around -inf 34.1%

      \[\leadsto c0 \cdot \color{blue}{e^{-0.5 \cdot \left(\log \left(-1 \cdot \frac{\ell}{A}\right) + -1 \cdot \log \left(\frac{-1}{V}\right)\right)}} \]
    7. Step-by-step derivation
      1. distribute-lft-in34.1%

        \[\leadsto c0 \cdot e^{\color{blue}{-0.5 \cdot \log \left(-1 \cdot \frac{\ell}{A}\right) + -0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}} \]
      2. exp-sum34.3%

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

        \[\leadsto c0 \cdot \left(e^{\color{blue}{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right) \]
      4. associate-*r/34.3%

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

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

        \[\leadsto c0 \cdot \left(e^{\log \left(\frac{\color{blue}{\frac{1}{-1}}}{\frac{A}{\ell}}\right) \cdot -0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right) \]
      7. associate-/r*34.3%

        \[\leadsto c0 \cdot \left(e^{\log \color{blue}{\left(\frac{1}{-1 \cdot \frac{A}{\ell}}\right)} \cdot -0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right) \]
      8. neg-mul-134.3%

        \[\leadsto c0 \cdot \left(e^{\log \left(\frac{1}{\color{blue}{-\frac{A}{\ell}}}\right) \cdot -0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right) \]
      9. exp-to-pow34.3%

        \[\leadsto c0 \cdot \left(\color{blue}{{\left(\frac{1}{-\frac{A}{\ell}}\right)}^{-0.5}} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right) \]
      10. neg-mul-134.3%

        \[\leadsto c0 \cdot \left({\left(\frac{1}{\color{blue}{-1 \cdot \frac{A}{\ell}}}\right)}^{-0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right) \]
      11. associate-/r*34.3%

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

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

        \[\leadsto c0 \cdot \left({\color{blue}{\left(\frac{-1 \cdot \ell}{A}\right)}}^{-0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right) \]
      14. neg-mul-134.3%

        \[\leadsto c0 \cdot \left({\left(\frac{\color{blue}{-\ell}}{A}\right)}^{-0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right) \]
      15. *-commutative34.3%

        \[\leadsto c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot e^{\color{blue}{\left(-1 \cdot \log \left(\frac{-1}{V}\right)\right) \cdot -0.5}}\right) \]
      16. *-commutative34.3%

        \[\leadsto c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot e^{\color{blue}{\left(\log \left(\frac{-1}{V}\right) \cdot -1\right)} \cdot -0.5}\right) \]
      17. associate-*l*34.3%

        \[\leadsto c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot e^{\color{blue}{\log \left(\frac{-1}{V}\right) \cdot \left(-1 \cdot -0.5\right)}}\right) \]
    8. Simplified36.0%

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

    if 1.00000023e-317 < (*.f64 V l)

    1. Initial program 80.5%

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

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

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)} \]
      3. pow1/291.6%

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.9%

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

Alternative 2: 80.1% accurate, 0.2× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ t_1 := \frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{if}\;t_0 \leq -4 \cdot 10^{-319}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+289}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{c0 \cdot A}{\ell \cdot \frac{V}{c0}}}\\ \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 (* c0 (sqrt (/ A (* V l))))) (t_1 (/ c0 (sqrt (/ (* V l) A)))))
   (if (<= t_0 -4e-319)
     t_1
     (if (<= t_0 0.0)
       (* c0 (sqrt (/ (/ A V) l)))
       (if (<= t_0 5e+289) t_1 (sqrt (/ (* c0 A) (* l (/ V c0)))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = c0 * sqrt((A / (V * l)));
	double t_1 = c0 / sqrt(((V * l) / A));
	double tmp;
	if (t_0 <= -4e-319) {
		tmp = t_1;
	} else if (t_0 <= 0.0) {
		tmp = c0 * sqrt(((A / V) / l));
	} else if (t_0 <= 5e+289) {
		tmp = t_1;
	} else {
		tmp = sqrt(((c0 * A) / (l * (V / c0))));
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = c0 * sqrt((a / (v * l)))
    t_1 = c0 / sqrt(((v * l) / a))
    if (t_0 <= (-4d-319)) then
        tmp = t_1
    else if (t_0 <= 0.0d0) then
        tmp = c0 * sqrt(((a / v) / l))
    else if (t_0 <= 5d+289) then
        tmp = t_1
    else
        tmp = sqrt(((c0 * a) / (l * (v / c0))))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = c0 * Math.sqrt((A / (V * l)));
	double t_1 = c0 / Math.sqrt(((V * l) / A));
	double tmp;
	if (t_0 <= -4e-319) {
		tmp = t_1;
	} else if (t_0 <= 0.0) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else if (t_0 <= 5e+289) {
		tmp = t_1;
	} else {
		tmp = Math.sqrt(((c0 * A) / (l * (V / c0))));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	t_0 = c0 * math.sqrt((A / (V * l)))
	t_1 = c0 / math.sqrt(((V * l) / A))
	tmp = 0
	if t_0 <= -4e-319:
		tmp = t_1
	elif t_0 <= 0.0:
		tmp = c0 * math.sqrt(((A / V) / l))
	elif t_0 <= 5e+289:
		tmp = t_1
	else:
		tmp = math.sqrt(((c0 * A) / (l * (V / c0))))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	t_0 = Float64(c0 * sqrt(Float64(A / Float64(V * l))))
	t_1 = Float64(c0 / sqrt(Float64(Float64(V * l) / A)))
	tmp = 0.0
	if (t_0 <= -4e-319)
		tmp = t_1;
	elseif (t_0 <= 0.0)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	elseif (t_0 <= 5e+289)
		tmp = t_1;
	else
		tmp = sqrt(Float64(Float64(c0 * A) / Float64(l * Float64(V / c0))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	t_0 = c0 * sqrt((A / (V * l)));
	t_1 = c0 / sqrt(((V * l) / A));
	tmp = 0.0;
	if (t_0 <= -4e-319)
		tmp = t_1;
	elseif (t_0 <= 0.0)
		tmp = c0 * sqrt(((A / V) / l));
	elseif (t_0 <= 5e+289)
		tmp = t_1;
	else
		tmp = sqrt(((c0 * A) / (l * (V / c0))));
	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[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-319], t$95$1, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+289], t$95$1, N[Sqrt[N[(N[(c0 * A), $MachinePrecision] / N[(l * N[(V / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
t_1 := \frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\
\mathbf{if}\;t_0 \leq -4 \cdot 10^{-319}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+289}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < -4.0000049e-319 or -0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 5.00000000000000031e289

    1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}} \]
    6. Step-by-step derivation
      1. sqr-pow91.2%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\frac{V \cdot \ell}{A}}}} \]
      6. un-div-inv91.7%

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

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

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

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

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

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

    if -4.0000049e-319 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < -0.0

    1. Initial program 38.5%

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)}^{2}} \]
      3. pow1/238.5%

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left({\left(\frac{A}{V \cdot \ell}\right)}^{0.25}\right)}^{2}} \]
    4. Taylor expanded in c0 around 0 38.5%

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

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

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

    if 5.00000000000000031e289 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 41.1%

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)}^{2}} \]
      3. pow1/241.1%

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left({\left(\frac{A}{V \cdot \ell}\right)}^{0.25}\right)}^{2}} \]
    4. Step-by-step derivation
      1. pow-pow41.1%

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

        \[\leadsto c0 \cdot {\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{0.5}} \]
      3. pow1/241.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
      9. add-sqr-sqrt51.0%

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{c0 \cdot c0}{\sqrt{V \cdot \frac{\ell}{A}} \cdot \sqrt{V \cdot \frac{\ell}{A}}}}} \]
      12. add-sqr-sqrt50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 90.0% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := c0 \cdot \frac{1}{\frac{\sqrt{-V}}{\sqrt{\frac{-A}{\ell}}}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-306}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-317}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\ \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 (* c0 (/ 1.0 (/ (sqrt (- V)) (sqrt (/ (- A) l)))))))
   (if (<= (* V l) (- INFINITY))
     t_0
     (if (<= (* V l) -5e-306)
       (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
       (if (<= (* V l) 1e-317) t_0 (* c0 (* (sqrt A) (pow (* V l) -0.5))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = c0 * (1.0 / (sqrt(-V) / sqrt((-A / l))));
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = t_0;
	} else if ((V * l) <= -5e-306) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 1e-317) {
		tmp = t_0;
	} else {
		tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
	}
	return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = c0 * (1.0 / (Math.sqrt(-V) / Math.sqrt((-A / l))));
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = t_0;
	} else if ((V * l) <= -5e-306) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 1e-317) {
		tmp = t_0;
	} else {
		tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	t_0 = c0 * (1.0 / (math.sqrt(-V) / math.sqrt((-A / l))))
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = t_0
	elif (V * l) <= -5e-306:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 1e-317:
		tmp = t_0
	else:
		tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	t_0 = Float64(c0 * Float64(1.0 / Float64(sqrt(Float64(-V)) / sqrt(Float64(Float64(-A) / l)))))
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = t_0;
	elseif (Float64(V * l) <= -5e-306)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 1e-317)
		tmp = t_0;
	else
		tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5)));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	t_0 = c0 * (1.0 / (sqrt(-V) / sqrt((-A / l))));
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = t_0;
	elseif ((V * l) <= -5e-306)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 1e-317)
		tmp = t_0;
	else
		tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
	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[(c0 * N[(1.0 / N[(N[Sqrt[(-V)], $MachinePrecision] / N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -5e-306], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e-317], t$95$0, N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \frac{1}{\frac{\sqrt{-V}}{\sqrt{\frac{-A}{\ell}}}}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;V \cdot \ell \leq 10^{-317}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 V l) < -inf.0 or -4.99999999999999998e-306 < (*.f64 V l) < 1.00000023e-317

    1. Initial program 27.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -4.99999999999999998e-306

    1. Initial program 84.8%

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

        \[\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 1.00000023e-317 < (*.f64 V l)

    1. Initial program 80.5%

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

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

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)} \]
      3. pow1/291.6%

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.9%

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

Alternative 4: 90.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}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-306}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot {\left(V \cdot \frac{-1}{\frac{-A}{\ell}}\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\ \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 V)) (sqrt l)))
   (if (<= (* V l) -5e-306)
     (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
     (if (<= (* V l) 0.0)
       (* c0 (pow (* V (/ -1.0 (/ (- A) l))) -0.5))
       (* c0 (* (sqrt A) (pow (* V l) -0.5)))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else if ((V * l) <= -5e-306) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = c0 * pow((V * (-1.0 / (-A / l))), -0.5);
	} else {
		tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
	}
	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 / V)) / Math.sqrt(l));
	} else if ((V * l) <= -5e-306) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = c0 * Math.pow((V * (-1.0 / (-A / l))), -0.5);
	} else {
		tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
	}
	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 / V)) / math.sqrt(l))
	elif (V * l) <= -5e-306:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 0.0:
		tmp = c0 * math.pow((V * (-1.0 / (-A / l))), -0.5)
	else:
		tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5))
	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(A / V)) / sqrt(l)));
	elseif (Float64(V * l) <= -5e-306)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 0.0)
		tmp = Float64(c0 * (Float64(V * Float64(-1.0 / Float64(Float64(-A) / l))) ^ -0.5));
	else
		tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5)));
	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 / V)) / sqrt(l));
	elseif ((V * l) <= -5e-306)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 0.0)
		tmp = c0 * ((V * (-1.0 / (-A / l))) ^ -0.5);
	else
		tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
	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 / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-306], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[Power[N[(V * N[(-1.0 / N[((-A) / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $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}{V}}}{\sqrt{\ell}}\\

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

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\


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

    1. Initial program 16.6%

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

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

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

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

    if -inf.0 < (*.f64 V l) < -4.99999999999999998e-306

    1. Initial program 84.8%

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

        \[\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 -4.99999999999999998e-306 < (*.f64 V l) < -0.0

    1. Initial program 39.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 79.8%

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

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

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)} \]
      3. pow1/290.8%

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification88.0%

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

Alternative 5: 84.4% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;A \leq -5 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\ \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 (<= A -5e-310)
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (* c0 (* (sqrt A) (pow (* V l) -0.5)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if (A <= -5e-310) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else {
		tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
	}
	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 (a <= (-5d-310)) then
        tmp = c0 * (sqrt((a / v)) / sqrt(l))
    else
        tmp = c0 * (sqrt(a) * ((v * l) ** (-0.5d0)))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if (A <= -5e-310) {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else {
		tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if A <= -5e-310:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	else:
		tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (A <= -5e-310)
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	else
		tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5)));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if (A <= -5e-310)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	else
		tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
	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[A, -5e-310], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\


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

    1. Initial program 68.3%

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

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

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

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

    if -4.999999999999985e-310 < A

    1. Initial program 76.6%

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

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

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)} \]
      3. pow1/286.4%

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.8%

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

Alternative 6: 81.8% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \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 (<= l -5e-310)
   (* c0 (sqrt (/ A (* V l))))
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if (l <= -5e-310) {
		tmp = c0 * sqrt((A / (V * l)));
	} else {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	}
	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 (l <= (-5d-310)) then
        tmp = c0 * sqrt((a / (v * l)))
    else
        tmp = c0 * (sqrt((a / v)) / sqrt(l))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if (l <= -5e-310) {
		tmp = c0 * Math.sqrt((A / (V * l)));
	} else {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if l <= -5e-310:
		tmp = c0 * math.sqrt((A / (V * l)))
	else:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (l <= -5e-310)
		tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l))));
	else
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if (l <= -5e-310)
		tmp = c0 * sqrt((A / (V * l)));
	else
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	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[l, -5e-310], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\

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


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

    1. Initial program 73.3%

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

    if -4.999999999999985e-310 < l

    1. Initial program 71.2%

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

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

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

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

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

Alternative 7: 83.1% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;A \leq -5 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\ \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 (<= A -5e-310)
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (* (sqrt A) (/ c0 (sqrt (* V l))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if (A <= -5e-310) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else {
		tmp = sqrt(A) * (c0 / sqrt((V * l)));
	}
	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 (a <= (-5d-310)) then
        tmp = c0 * (sqrt((a / v)) / sqrt(l))
    else
        tmp = sqrt(a) * (c0 / sqrt((v * l)))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if (A <= -5e-310) {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else {
		tmp = Math.sqrt(A) * (c0 / Math.sqrt((V * l)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if A <= -5e-310:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	else:
		tmp = math.sqrt(A) * (c0 / math.sqrt((V * l)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (A <= -5e-310)
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	else
		tmp = Float64(sqrt(A) * Float64(c0 / sqrt(Float64(V * l))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if (A <= -5e-310)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	else
		tmp = sqrt(A) * (c0 / sqrt((V * l)));
	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[A, -5e-310], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[A], $MachinePrecision] * N[(c0 / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

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


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

    1. Initial program 68.3%

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

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

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

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

    if -4.999999999999985e-310 < A

    1. Initial program 76.6%

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

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

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

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

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

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

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

Alternative 8: 84.4% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;A \leq -5 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \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 (<= A -5e-310)
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (* c0 (/ (sqrt A) (sqrt (* V l))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if (A <= -5e-310) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	}
	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 (a <= (-5d-310)) then
        tmp = c0 * (sqrt((a / v)) / sqrt(l))
    else
        tmp = c0 * (sqrt(a) / sqrt((v * l)))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if (A <= -5e-310) {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if A <= -5e-310:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	else:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (A <= -5e-310)
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	else
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if (A <= -5e-310)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	else
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	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[A, -5e-310], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

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


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

    1. Initial program 68.3%

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

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

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

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

    if -4.999999999999985e-310 < A

    1. Initial program 76.6%

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

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

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

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

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

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

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

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

Alternative 9: 80.9% 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}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+297}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \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 V) l)))
     (if (<= t_0 5e+297) (* c0 (sqrt t_0)) (/ c0 (sqrt (* V (/ l A))))))))
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 / V) / l));
	} else if (t_0 <= 5e+297) {
		tmp = c0 * sqrt(t_0);
	} else {
		tmp = c0 / sqrt((V * (l / A)));
	}
	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 / v) / l))
    else if (t_0 <= 5d+297) then
        tmp = c0 * sqrt(t_0)
    else
        tmp = c0 / sqrt((v * (l / a)))
    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 / V) / l));
	} else if (t_0 <= 5e+297) {
		tmp = c0 * Math.sqrt(t_0);
	} else {
		tmp = c0 / Math.sqrt((V * (l / A)));
	}
	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 / V) / l))
	elif t_0 <= 5e+297:
		tmp = c0 * math.sqrt(t_0)
	else:
		tmp = c0 / math.sqrt((V * (l / A)))
	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 / V) / l)));
	elseif (t_0 <= 5e+297)
		tmp = Float64(c0 * sqrt(t_0));
	else
		tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A))));
	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 / V) / l));
	elseif (t_0 <= 5e+297)
		tmp = c0 * sqrt(t_0);
	else
		tmp = c0 / sqrt((V * (l / A)));
	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 / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+297], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $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}{V}}{\ell}}\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+297}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\

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


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

    1. Initial program 32.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt32.0%

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)} \]
      2. pow232.0%

        \[\leadsto c0 \cdot \color{blue}{{\left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)}^{2}} \]
      3. pow1/232.0%

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left({\left(\frac{A}{V \cdot \ell}\right)}^{0.25}\right)}^{2}} \]
    4. Taylor expanded in c0 around 0 32.0%

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

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

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

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

    1. Initial program 98.9%

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

    if 4.9999999999999998e297 < (/.f64 A (*.f64 V l))

    1. Initial program 32.5%

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

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

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}} \]
    6. Step-by-step derivation
      1. sqr-pow35.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 78.0% 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}{V}}{\ell}}\\ \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 V) l))) (* 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 / V) / l));
	} 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 / v) / l))
    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 / V) / l));
	} 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 / V) / l))
	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 / V) / l)));
	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 / V) / l));
	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 / V), $MachinePrecision] / l), $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}{V}}{\ell}}\\

\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 32.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt32.0%

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)} \]
      2. pow232.0%

        \[\leadsto c0 \cdot \color{blue}{{\left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)}^{2}} \]
      3. pow1/232.0%

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left({\left(\frac{A}{V \cdot \ell}\right)}^{0.25}\right)}^{2}} \]
    4. Taylor expanded in c0 around 0 32.0%

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

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

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

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

    1. Initial program 83.9%

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

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

Alternative 11: 78.1% accurate, 0.9× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;\frac{A}{V \cdot \ell} \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \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 (<= (/ A (* V l)) 0.0)
   (* c0 (sqrt (/ (/ A V) l)))
   (/ c0 (sqrt (/ (* V l) A)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((A / (V * l)) <= 0.0) {
		tmp = c0 * sqrt(((A / V) / l));
	} else {
		tmp = c0 / sqrt(((V * l) / A));
	}
	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 ((a / (v * l)) <= 0.0d0) then
        tmp = c0 * sqrt(((a / v) / l))
    else
        tmp = c0 / sqrt(((v * l) / a))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((A / (V * l)) <= 0.0) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else {
		tmp = c0 / Math.sqrt(((V * l) / A));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	tmp = 0
	if (A / (V * l)) <= 0.0:
		tmp = c0 * math.sqrt(((A / V) / l))
	else:
		tmp = c0 / math.sqrt(((V * l) / A))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(A / Float64(V * l)) <= 0.0)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	else
		tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A)));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((A / (V * l)) <= 0.0)
		tmp = c0 * sqrt(((A / V) / l));
	else
		tmp = c0 / sqrt(((V * l) / A));
	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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision], 0.0], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{A}{V \cdot \ell} \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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


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

    1. Initial program 32.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt32.0%

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)} \]
      2. pow232.0%

        \[\leadsto c0 \cdot \color{blue}{{\left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)}^{2}} \]
      3. pow1/232.0%

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left({\left(\frac{A}{V \cdot \ell}\right)}^{0.25}\right)}^{2}} \]
    4. Taylor expanded in c0 around 0 32.0%

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

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

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

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

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}} \]
    6. Step-by-step derivation
      1. sqr-pow84.2%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\frac{V \cdot \ell}{A}}}} \]
      6. un-div-inv84.5%

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}} \]
      7. div-inv84.5%

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

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

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

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

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

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

Alternative 12: 74.4% 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 72.3%

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

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

Reproduce

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