Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.0% → 90.5%
Time: 6.8s
Alternatives: 11
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 11 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: 90.5% accurate, 0.3× speedup?

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

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

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

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

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


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

    1. Initial program 51.8%

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

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

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

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

    if -1.9999999999999999e268 < (*.f64 V l) < -5.00000000000000008e-295

    1. Initial program 82.4%

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

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

    1. Initial program 43.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 5.00000000000000033e293

    1. Initial program 85.7%

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

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

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

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

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

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

    if 5.00000000000000033e293 < (*.f64 V l)

    1. Initial program 34.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 90.5% accurate, 0.5× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -1.9999999999999999e268 or 2.0000000000000002e302 < (*.f64 V l)

    1. Initial program 46.8%

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

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

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

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

    if -1.9999999999999999e268 < (*.f64 V l) < -5.00000000000000008e-295

    1. Initial program 82.4%

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

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

    1. Initial program 43.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 2.0000000000000002e302

    1. Initial program 85.0%

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

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

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

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

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

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

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

Alternative 3: 82.0% accurate, 0.5× speedup?

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

\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 < -1.999999999999994e-310

    1. Initial program 74.3%

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 72.8%

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

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

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

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

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

Alternative 4: 84.7% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{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 -2e-310)
   (* c0 (/ (sqrt A) (sqrt (* 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 <= -2e-310) {
		tmp = c0 * (sqrt(A) / sqrt((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 <= (-2d-310)) then
        tmp = c0 * (sqrt(a) / sqrt((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 <= -2e-310) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((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 <= -2e-310:
		tmp = c0 * (math.sqrt(A) / math.sqrt((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 <= -2e-310)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(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 <= -2e-310)
		tmp = c0 * (sqrt(A) / sqrt((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, -2e-310], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[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 -2 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{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 < -1.999999999999994e-310

    1. Initial program 74.3%

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 72.8%

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

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

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

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

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

Alternative 5: 84.6% accurate, 0.5× speedup?

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

\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 < -1.999999999999994e-310

    1. Initial program 74.3%

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 72.8%

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

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

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

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

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

Alternative 6: 80.3% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot {t_1}^{-0.5}\\


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

    1. Initial program 39.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.6%

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

    if 9.99999999999999964e277 < (/.f64 A (*.f64 V l))

    1. Initial program 42.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.9% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot {t_1}^{-0.5}\\


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

    1. Initial program 39.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999964e277 < (/.f64 A (*.f64 V l))

    1. Initial program 42.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 80.1% 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 \lor \neg \left(t_0 \leq 10^{+278}\right):\\ \;\;\;\;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 (or (<= t_0 0.0) (not (<= t_0 1e+278)))
     (* 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) || !(t_0 <= 1e+278)) {
		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) .or. (.not. (t_0 <= 1d+278))) 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) || !(t_0 <= 1e+278)) {
		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) or not (t_0 <= 1e+278):
		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) || !(t_0 <= 1e+278))
		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) || ~((t_0 <= 1e+278)))
		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[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 1e+278]], $MachinePrecision]], 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 \lor \neg \left(t_0 \leq 10^{+278}\right):\\
\;\;\;\;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 or 9.99999999999999964e277 < (/.f64 A (*.f64 V l))

    1. Initial program 40.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.6%

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

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

Alternative 9: 80.5% 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 \lor \neg \left(t_0 \leq 2 \cdot 10^{+305}\right):\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \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 (or (<= t_0 0.0) (not (<= t_0 2e+305)))
     (/ c0 (sqrt (* V (/ l A))))
     (* 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) || !(t_0 <= 2e+305)) {
		tmp = c0 / sqrt((V * (l / A)));
	} 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) .or. (.not. (t_0 <= 2d+305))) then
        tmp = c0 / sqrt((v * (l / a)))
    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) || !(t_0 <= 2e+305)) {
		tmp = c0 / Math.sqrt((V * (l / A)));
	} 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) or not (t_0 <= 2e+305):
		tmp = c0 / math.sqrt((V * (l / A)))
	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) || !(t_0 <= 2e+305))
		tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A))));
	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) || ~((t_0 <= 2e+305)))
		tmp = c0 / sqrt((V * (l / A)));
	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[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 2e+305]], $MachinePrecision]], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $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 \lor \neg \left(t_0 \leq 2 \cdot 10^{+305}\right):\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\

\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 or 1.9999999999999999e305 < (/.f64 A (*.f64 V l))

    1. Initial program 37.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{A}{V \cdot \ell} \leq 0 \lor \neg \left(\frac{A}{V \cdot \ell} \leq 2 \cdot 10^{+305}\right):\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \end{array} \]

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

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\

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


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

    1. Initial program 39.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.6%

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

    if 1.9999999999999999e305 < (/.f64 A (*.f64 V l))

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 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 73.6%

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

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

Reproduce

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