Henrywood and Agarwal, Equation (3)

Percentage Accurate: 76.0% → 92.4%
Time: 27.0s
Alternatives: 10
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 76.0% accurate, 1.0× speedup?

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

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

Alternative 1: 92.4% accurate, 0.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if A < -7.6000000000000003e-285

    1. Initial program 68.4%

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

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

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

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

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

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

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

    if -7.6000000000000003e-285 < A < 3e7

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

    if 3e7 < A

    1. Initial program 63.8%

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

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

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

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

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

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

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

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

Alternative 2: 82.7% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 35.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 5.0000000000000003e298

    1. Initial program 99.4%

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

    if 5.0000000000000003e298 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 28.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{\color{blue}{\frac{1}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}}} \]
      10. metadata-eval31.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 87.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^{-96}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{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 (<= (* V l) -1e-96)
   (/ c0 (sqrt (/ (* V l) A)))
   (if (<= (* V l) 0.0)
     (* (sqrt (/ A 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 ((V * l) <= -1e-96) {
		tmp = c0 / sqrt(((V * l) / A));
	} else if ((V * l) <= 0.0) {
		tmp = sqrt((A / 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 ((v * l) <= (-1d-96)) then
        tmp = c0 / sqrt(((v * l) / a))
    else if ((v * l) <= 0.0d0) then
        tmp = sqrt((a / 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 ((V * l) <= -1e-96) {
		tmp = c0 / Math.sqrt(((V * l) / A));
	} else if ((V * l) <= 0.0) {
		tmp = Math.sqrt((A / 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 (V * l) <= -1e-96:
		tmp = c0 / math.sqrt(((V * l) / A))
	elif (V * l) <= 0.0:
		tmp = math.sqrt((A / 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 (Float64(V * l) <= -1e-96)
		tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A)));
	elseif (Float64(V * l) <= 0.0)
		tmp = Float64(sqrt(Float64(A / V)) * Float64(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 ((V * l) <= -1e-96)
		tmp = c0 / sqrt(((V * l) / A));
	elseif ((V * l) <= 0.0)
		tmp = sqrt((A / 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[N[(V * l), $MachinePrecision], -1e-96], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-96}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \cdot \sqrt{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}\right)} \]
      6. add-sqr-sqrt45.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.9999999999999991e-97 < (*.f64 V l) < -0.0

    1. Initial program 46.4%

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 79.8%

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

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

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

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

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

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

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

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

Alternative 4: 88.0% 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^{-96}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\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-96)
   (/ c0 (sqrt (/ (* V l) A)))
   (if (<= (* V l) 0.0)
     (/ 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-96) {
		tmp = c0 / sqrt(((V * l) / A));
	} else if ((V * l) <= 0.0) {
		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-96)) then
        tmp = c0 / sqrt(((v * l) / a))
    else if ((v * l) <= 0.0d0) 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-96) {
		tmp = c0 / Math.sqrt(((V * l) / A));
	} else if ((V * l) <= 0.0) {
		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-96:
		tmp = c0 / math.sqrt(((V * l) / A))
	elif (V * l) <= 0.0:
		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-96)
		tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A)));
	elseif (Float64(V * l) <= 0.0)
		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-96)
		tmp = c0 / sqrt(((V * l) / A));
	elseif ((V * l) <= 0.0)
		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-96], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], 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^{-96}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\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 3 regimes
  2. if (*.f64 V l) < -9.9999999999999991e-97

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \cdot \sqrt{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}\right)} \]
      6. add-sqr-sqrt45.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.9999999999999991e-97 < (*.f64 V l) < -0.0

    1. Initial program 46.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 79.8%

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

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

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

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

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

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

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

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

Alternative 5: 91.5% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 83.2%

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

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

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

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

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

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

    if -1.5000000000002e-312 < (*.f64 V l) < -0.0

    1. Initial program 26.1%

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

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

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 79.8%

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

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

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

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

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

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

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

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

Alternative 6: 82.6% accurate, 0.5× 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 5 \cdot 10^{+306}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \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
 (let* ((t_0 (/ A (* V l))))
   (if (<= t_0 5e+306) (* c0 (sqrt t_0)) (* c0 (/ (sqrt (/ A V)) (sqrt l))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 5e+306) {
		tmp = c0 * sqrt(t_0);
	} 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) :: t_0
    real(8) :: tmp
    t_0 = a / (v * l)
    if (t_0 <= 5d+306) then
        tmp = c0 * sqrt(t_0)
    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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 5e+306) {
		tmp = c0 * Math.sqrt(t_0);
	} else {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	t_0 = A / (V * l)
	tmp = 0
	if t_0 <= 5e+306:
		tmp = c0 * math.sqrt(t_0)
	else:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	t_0 = Float64(A / Float64(V * l))
	tmp = 0.0
	if (t_0 <= 5e+306)
		tmp = Float64(c0 * sqrt(t_0));
	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)
	t_0 = A / (V * l);
	tmp = 0.0;
	if (t_0 <= 5e+306)
		tmp = c0 * sqrt(t_0);
	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_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+306], N[(c0 * N[Sqrt[t$95$0], $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}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\

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


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

    1. Initial program 99.4%

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

    if 4.99999999999999993e306 < (/.f64 A (*.f64 V l))

    1. Initial program 22.0%

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

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

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

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

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

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

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


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

    1. Initial program 99.4%

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

    if 1.0000000000000001e300 < (/.f64 A (*.f64 V l))

    1. Initial program 23.6%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 81.7% 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 5 \cdot 10^{+306}:\\ \;\;\;\;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 5e+306) (* 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 <= 5e+306) {
		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 <= 5d+306) 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 <= 5e+306) {
		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 <= 5e+306:
		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 <= 5e+306)
		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 <= 5e+306)
		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, 5e+306], 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 5 \cdot 10^{+306}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\

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


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

    1. Initial program 99.4%

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

    if 4.99999999999999993e306 < (/.f64 A (*.f64 V l))

    1. Initial program 22.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}} \]
      9. clear-num37.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 81.6% 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 10^{+300}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{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 1e+300) (* c0 (sqrt t_0)) (/ c0 (sqrt (* l (/ V 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 <= 1e+300) {
		tmp = c0 * sqrt(t_0);
	} else {
		tmp = c0 / sqrt((l * (V / 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 <= 1d+300) then
        tmp = c0 * sqrt(t_0)
    else
        tmp = c0 / sqrt((l * (v / 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 <= 1e+300) {
		tmp = c0 * Math.sqrt(t_0);
	} else {
		tmp = c0 / Math.sqrt((l * (V / A)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	t_0 = A / (V * l)
	tmp = 0
	if t_0 <= 1e+300:
		tmp = c0 * math.sqrt(t_0)
	else:
		tmp = c0 / math.sqrt((l * (V / 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 <= 1e+300)
		tmp = Float64(c0 * sqrt(t_0));
	else
		tmp = Float64(c0 / sqrt(Float64(l * Float64(V / 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 <= 1e+300)
		tmp = c0 * sqrt(t_0);
	else
		tmp = c0 / sqrt((l * (V / 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, 1e+300], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l * N[(V / 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 10^{+300}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\

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


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

    1. Initial program 99.4%

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

    if 1.0000000000000001e300 < (/.f64 A (*.f64 V l))

    1. Initial program 23.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}} \]
      9. clear-num37.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 76.0% accurate, 1.0× speedup?

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

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

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

Reproduce

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