Henrywood and Agarwal, Equation (3)

Percentage Accurate: 72.8% → 89.2%
Time: 11.6s
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: 72.8% 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: 89.2% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+189}:\\ \;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -8 \cdot 10^{-294}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-316}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \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 (<= (* V l) -1e+189)
   (* (sqrt (/ A V)) (/ c0 (sqrt l)))
   (if (<= (* V l) -8e-294)
     (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
     (if (<= (* V l) 5e-316)
       (/ c0 (* (sqrt l) (sqrt (/ V A))))
       (* c0 (/ (sqrt A) (sqrt (* V l))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -1e+189) {
		tmp = sqrt((A / V)) * (c0 / sqrt(l));
	} else if ((V * l) <= -8e-294) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 5e-316) {
		tmp = c0 / (sqrt(l) * sqrt((V / A)));
	} 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 ((v * l) <= (-1d+189)) then
        tmp = sqrt((a / v)) * (c0 / sqrt(l))
    else if ((v * l) <= (-8d-294)) then
        tmp = c0 * (sqrt(-a) / sqrt((v * -l)))
    else if ((v * l) <= 5d-316) then
        tmp = c0 / (sqrt(l) * sqrt((v / a)))
    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 ((V * l) <= -1e+189) {
		tmp = Math.sqrt((A / V)) * (c0 / Math.sqrt(l));
	} else if ((V * l) <= -8e-294) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 5e-316) {
		tmp = c0 / (Math.sqrt(l) * Math.sqrt((V / A)));
	} 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 (V * l) <= -1e+189:
		tmp = math.sqrt((A / V)) * (c0 / math.sqrt(l))
	elif (V * l) <= -8e-294:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 5e-316:
		tmp = c0 / (math.sqrt(l) * math.sqrt((V / A)))
	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 (Float64(V * l) <= -1e+189)
		tmp = Float64(sqrt(Float64(A / V)) * Float64(c0 / sqrt(l)));
	elseif (Float64(V * l) <= -8e-294)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 5e-316)
		tmp = Float64(c0 / Float64(sqrt(l) * sqrt(Float64(V / A))));
	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 ((V * l) <= -1e+189)
		tmp = sqrt((A / V)) * (c0 / sqrt(l));
	elseif ((V * l) <= -8e-294)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 5e-316)
		tmp = c0 / (sqrt(l) * sqrt((V / A)));
	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[N[(V * l), $MachinePrecision], -1e+189], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -8e-294], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-316], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[N[(V / A), $MachinePrecision]], $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}\;V \cdot \ell \leq -1 \cdot 10^{+189}:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\

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

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

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


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

    1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e189 < (*.f64 V l) < -8.00000000000000013e-294

    1. Initial program 87.5%

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

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

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

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

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

    if -8.00000000000000013e-294 < (*.f64 V l) < 5.000000017e-316

    1. Initial program 34.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.000000017e-316 < (*.f64 V l)

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+189}:\\ \;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -8 \cdot 10^{-294}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-316}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]

Alternative 2: 89.7% accurate, 0.3× speedup?

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

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

    1. Initial program 72.9%

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

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

        \[\leadsto {\left(c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\right)}^{\color{blue}{\left(0.5 + 0.5\right)}} \]
      3. pow-prod-up38.0%

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

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

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

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

        \[\leadsto {\color{blue}{\left(\left(\sqrt{\frac{A}{V \cdot \ell}} \cdot \sqrt{\frac{A}{V \cdot \ell}}\right) \cdot \left(c0 \cdot c0\right)\right)}}^{0.5} \]
      8. add-sqr-sqrt26.7%

        \[\leadsto {\left(\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)\right)}^{0.5} \]
      9. associate-/r*26.0%

        \[\leadsto {\left(\color{blue}{\frac{\frac{A}{V}}{\ell}} \cdot \left(c0 \cdot c0\right)\right)}^{0.5} \]
      10. pow226.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < A

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

Alternative 3: 89.6% accurate, 0.3× speedup?

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

    1. Initial program 72.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{{c0}^{2} \cdot \color{blue}{\frac{1 \cdot 1}{\sqrt{\frac{V}{A} \cdot \ell} \cdot \sqrt{\frac{V}{A} \cdot \ell}}}} \]
      6. add-sqr-sqrt25.3%

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < A

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 V l) < -2.00000000000000015e191 or -1.99999999999999999e-90 < (*.f64 V l) < 5.000000017e-316

    1. Initial program 54.8%

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

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

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

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

    if -2.00000000000000015e191 < (*.f64 V l) < -1.99999999999999999e-90

    1. Initial program 97.8%

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

    if 5.000000017e-316 < (*.f64 V l)

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 84.8% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{A}{V}}\\ \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+189}:\\ \;\;\;\;t_0 \cdot \frac{c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-90}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-316}:\\ \;\;\;\;c0 \cdot \frac{t_0}{\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
 (let* ((t_0 (sqrt (/ A V))))
   (if (<= (* V l) -1e+189)
     (* t_0 (/ c0 (sqrt l)))
     (if (<= (* V l) -2e-90)
       (* c0 (sqrt (/ A (* V l))))
       (if (<= (* V l) 5e-316)
         (* c0 (/ t_0 (sqrt l)))
         (* (sqrt A) (/ c0 (sqrt (* V l)))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = sqrt((A / V));
	double tmp;
	if ((V * l) <= -1e+189) {
		tmp = t_0 * (c0 / sqrt(l));
	} else if ((V * l) <= -2e-90) {
		tmp = c0 * sqrt((A / (V * l)));
	} else if ((V * l) <= 5e-316) {
		tmp = c0 * (t_0 / 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) :: t_0
    real(8) :: tmp
    t_0 = sqrt((a / v))
    if ((v * l) <= (-1d+189)) then
        tmp = t_0 * (c0 / sqrt(l))
    else if ((v * l) <= (-2d-90)) then
        tmp = c0 * sqrt((a / (v * l)))
    else if ((v * l) <= 5d-316) then
        tmp = c0 * (t_0 / 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 t_0 = Math.sqrt((A / V));
	double tmp;
	if ((V * l) <= -1e+189) {
		tmp = t_0 * (c0 / Math.sqrt(l));
	} else if ((V * l) <= -2e-90) {
		tmp = c0 * Math.sqrt((A / (V * l)));
	} else if ((V * l) <= 5e-316) {
		tmp = c0 * (t_0 / 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):
	t_0 = math.sqrt((A / V))
	tmp = 0
	if (V * l) <= -1e+189:
		tmp = t_0 * (c0 / math.sqrt(l))
	elif (V * l) <= -2e-90:
		tmp = c0 * math.sqrt((A / (V * l)))
	elif (V * l) <= 5e-316:
		tmp = c0 * (t_0 / 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)
	t_0 = sqrt(Float64(A / V))
	tmp = 0.0
	if (Float64(V * l) <= -1e+189)
		tmp = Float64(t_0 * Float64(c0 / sqrt(l)));
	elseif (Float64(V * l) <= -2e-90)
		tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l))));
	elseif (Float64(V * l) <= 5e-316)
		tmp = Float64(c0 * Float64(t_0 / 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)
	t_0 = sqrt((A / V));
	tmp = 0.0;
	if ((V * l) <= -1e+189)
		tmp = t_0 * (c0 / sqrt(l));
	elseif ((V * l) <= -2e-90)
		tmp = c0 * sqrt((A / (V * l)));
	elseif ((V * l) <= 5e-316)
		tmp = c0 * (t_0 / 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_] := Block[{t$95$0 = N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -1e+189], N[(t$95$0 * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -2e-90], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-316], N[(c0 * N[(t$95$0 / 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}
t_0 := \sqrt{\frac{A}{V}}\\
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+189}:\\
\;\;\;\;t_0 \cdot \frac{c0}{\sqrt{\ell}}\\

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

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

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


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

    1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e189 < (*.f64 V l) < -1.99999999999999999e-90

    1. Initial program 97.8%

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

    if -1.99999999999999999e-90 < (*.f64 V l) < 5.000000017e-316

    1. Initial program 56.9%

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

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

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

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

    if 5.000000017e-316 < (*.f64 V l)

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 86.1% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{A}{V}}\\ \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+189}:\\ \;\;\;\;t_0 \cdot \frac{c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-90}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-316}:\\ \;\;\;\;c0 \cdot \frac{t_0}{\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
 (let* ((t_0 (sqrt (/ A V))))
   (if (<= (* V l) -1e+189)
     (* t_0 (/ c0 (sqrt l)))
     (if (<= (* V l) -2e-90)
       (* c0 (sqrt (/ A (* V l))))
       (if (<= (* V l) 5e-316)
         (* c0 (/ t_0 (sqrt l)))
         (* c0 (/ (sqrt A) (sqrt (* V l)))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = sqrt((A / V));
	double tmp;
	if ((V * l) <= -1e+189) {
		tmp = t_0 * (c0 / sqrt(l));
	} else if ((V * l) <= -2e-90) {
		tmp = c0 * sqrt((A / (V * l)));
	} else if ((V * l) <= 5e-316) {
		tmp = c0 * (t_0 / 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) :: t_0
    real(8) :: tmp
    t_0 = sqrt((a / v))
    if ((v * l) <= (-1d+189)) then
        tmp = t_0 * (c0 / sqrt(l))
    else if ((v * l) <= (-2d-90)) then
        tmp = c0 * sqrt((a / (v * l)))
    else if ((v * l) <= 5d-316) then
        tmp = c0 * (t_0 / 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 t_0 = Math.sqrt((A / V));
	double tmp;
	if ((V * l) <= -1e+189) {
		tmp = t_0 * (c0 / Math.sqrt(l));
	} else if ((V * l) <= -2e-90) {
		tmp = c0 * Math.sqrt((A / (V * l)));
	} else if ((V * l) <= 5e-316) {
		tmp = c0 * (t_0 / 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):
	t_0 = math.sqrt((A / V))
	tmp = 0
	if (V * l) <= -1e+189:
		tmp = t_0 * (c0 / math.sqrt(l))
	elif (V * l) <= -2e-90:
		tmp = c0 * math.sqrt((A / (V * l)))
	elif (V * l) <= 5e-316:
		tmp = c0 * (t_0 / 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)
	t_0 = sqrt(Float64(A / V))
	tmp = 0.0
	if (Float64(V * l) <= -1e+189)
		tmp = Float64(t_0 * Float64(c0 / sqrt(l)));
	elseif (Float64(V * l) <= -2e-90)
		tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l))));
	elseif (Float64(V * l) <= 5e-316)
		tmp = Float64(c0 * Float64(t_0 / 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)
	t_0 = sqrt((A / V));
	tmp = 0.0;
	if ((V * l) <= -1e+189)
		tmp = t_0 * (c0 / sqrt(l));
	elseif ((V * l) <= -2e-90)
		tmp = c0 * sqrt((A / (V * l)));
	elseif ((V * l) <= 5e-316)
		tmp = c0 * (t_0 / 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_] := Block[{t$95$0 = N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -1e+189], N[(t$95$0 * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -2e-90], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-316], N[(c0 * N[(t$95$0 / 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}
t_0 := \sqrt{\frac{A}{V}}\\
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+189}:\\
\;\;\;\;t_0 \cdot \frac{c0}{\sqrt{\ell}}\\

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

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

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


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

    1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e189 < (*.f64 V l) < -1.99999999999999999e-90

    1. Initial program 97.8%

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

    if -1.99999999999999999e-90 < (*.f64 V l) < 5.000000017e-316

    1. Initial program 56.9%

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

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

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

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

    if 5.000000017e-316 < (*.f64 V l)

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

Alternative 7: 85.9% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e189 < (*.f64 V l) < -9.9999999999999993e-41

    1. Initial program 99.8%

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

    if -9.9999999999999993e-41 < (*.f64 V l) < 5.000000017e-316

    1. Initial program 57.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.000000017e-316 < (*.f64 V l)

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

Alternative 8: 81.1% accurate, 0.5× speedup?

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

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

    1. Initial program 69.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{\frac{-\sqrt{\frac{V}{\frac{A}{\ell}}}}{-1}}} \]
      9. neg-mul-169.5%

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

        \[\leadsto \frac{c0}{\color{blue}{\frac{-1}{\frac{-1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}}}} \]
      11. metadata-eval69.5%

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

        \[\leadsto \frac{c0}{\frac{-1}{\color{blue}{\frac{1}{-1 \cdot \sqrt{\frac{V}{\frac{A}{\ell}}}}}}} \]
      13. neg-mul-169.5%

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

        \[\leadsto \frac{c0}{\color{blue}{\frac{-1 \cdot \left(-\sqrt{\frac{V}{\frac{A}{\ell}}}\right)}{1}}} \]
      15. neg-mul-169.5%

        \[\leadsto \frac{c0}{\frac{\color{blue}{-\left(-\sqrt{\frac{V}{\frac{A}{\ell}}}\right)}}{1}} \]
      16. remove-double-neg69.5%

        \[\leadsto \frac{c0}{\frac{\color{blue}{\sqrt{\frac{V}{\frac{A}{\ell}}}}}{1}} \]
      17. /-rgt-identity69.5%

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

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

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

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

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

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

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

    if -3.999999999999988e-310 < l

    1. Initial program 73.8%

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

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

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

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

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

Alternative 9: 78.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 \lor \neg \left(t_0 \leq 5 \cdot 10^{+257}\right):\\ \;\;\;\;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 (or (<= t_0 0.0) (not (<= t_0 5e+257)))
     (* 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) || !(t_0 <= 5e+257)) {
		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) .or. (.not. (t_0 <= 5d+257))) 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) || !(t_0 <= 5e+257)) {
		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) or not (t_0 <= 5e+257):
		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) || !(t_0 <= 5e+257))
		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) || ~((t_0 <= 5e+257)))
		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[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 5e+257]], $MachinePrecision]], 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 \lor \neg \left(t_0 \leq 5 \cdot 10^{+257}\right):\\
\;\;\;\;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 or 5.00000000000000028e257 < (/.f64 A (*.f64 V l))

    1. Initial program 41.4%

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

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

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

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

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

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

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

    1. Initial program 99.2%

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

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

Alternative 10: 79.4% accurate, 0.9× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+282}:\\ \;\;\;\;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+282) (* 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+282) {
		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+282) 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+282) {
		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+282:
		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+282)
		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+282)
		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+282], 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^{+282}:\\
\;\;\;\;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 39.9%

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

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

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

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

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

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

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

    1. Initial program 99.2%

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

    if 4.99999999999999978e282 < (/.f64 A (*.f64 V l))

    1. Initial program 36.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{\frac{-\sqrt{\frac{V}{\frac{A}{\ell}}}}{-1}}} \]
      9. neg-mul-151.7%

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

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

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

        \[\leadsto \frac{c0}{\frac{-1}{\color{blue}{\frac{1}{-1 \cdot \sqrt{\frac{V}{\frac{A}{\ell}}}}}}} \]
      13. neg-mul-151.7%

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

        \[\leadsto \frac{c0}{\color{blue}{\frac{-1 \cdot \left(-\sqrt{\frac{V}{\frac{A}{\ell}}}\right)}{1}}} \]
      15. neg-mul-151.7%

        \[\leadsto \frac{c0}{\frac{\color{blue}{-\left(-\sqrt{\frac{V}{\frac{A}{\ell}}}\right)}}{1}} \]
      16. remove-double-neg51.7%

        \[\leadsto \frac{c0}{\frac{\color{blue}{\sqrt{\frac{V}{\frac{A}{\ell}}}}}{1}} \]
      17. /-rgt-identity51.7%

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

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

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

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

    \[\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^{+282}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]

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

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+282}:\\
\;\;\;\;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 39.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.2%

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

    if 4.99999999999999978e282 < (/.f64 A (*.f64 V l))

    1. Initial program 36.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{\frac{-\sqrt{\frac{V}{\frac{A}{\ell}}}}{-1}}} \]
      9. neg-mul-151.7%

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

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

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

        \[\leadsto \frac{c0}{\frac{-1}{\color{blue}{\frac{1}{-1 \cdot \sqrt{\frac{V}{\frac{A}{\ell}}}}}}} \]
      13. neg-mul-151.7%

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

        \[\leadsto \frac{c0}{\color{blue}{\frac{-1 \cdot \left(-\sqrt{\frac{V}{\frac{A}{\ell}}}\right)}{1}}} \]
      15. neg-mul-151.7%

        \[\leadsto \frac{c0}{\frac{\color{blue}{-\left(-\sqrt{\frac{V}{\frac{A}{\ell}}}\right)}}{1}} \]
      16. remove-double-neg51.7%

        \[\leadsto \frac{c0}{\frac{\color{blue}{\sqrt{\frac{V}{\frac{A}{\ell}}}}}{1}} \]
      17. /-rgt-identity51.7%

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

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

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

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

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

Alternative 12: 72.8% 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 71.4%

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

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

Reproduce

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