Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.4% → 90.0%
Time: 9.7s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 74.4% accurate, 1.0× speedup?

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

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

Alternative 1: 90.0% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{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) < -inf.0

    1. Initial program 46.7%

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

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

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

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

    if -inf.0 < (*.f64 V l) < -2e-281

    1. Initial program 85.2%

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

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}}\right)} - 1 \]
      5. associate-/r*24.5%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      8. un-div-inv12.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{\color{blue}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{\sqrt{-A}}}} \]
    12. Step-by-step derivation
      1. distribute-rgt-neg-out99.4%

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

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

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

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

    if -2e-281 < (*.f64 V l) < 0.0

    1. Initial program 53.8%

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}}\right)} - 1 \]
      4. *-un-lft-identity32.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}}\right)} - 1 \]
      5. associate-/r*35.8%

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}\right)} - 1 \]
      7. clear-num18.8%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      8. un-div-inv18.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      9. sqrt-undiv35.8%

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

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

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

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

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

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

    if 0.0 < (*.f64 V l)

    1. Initial program 77.6%

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

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

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

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

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

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

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

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

Alternative 2: 83.1% accurate, 0.2× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ t_1 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq -4 \cdot 10^{-320}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+304}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A \cdot c0}{\ell} \cdot \frac{c0}{V}}\\ \end{array} \end{array} \]
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (* c0 (/ (sqrt (/ A V)) (sqrt l))))
        (t_1 (* c0 (sqrt (/ A (* V l))))))
   (if (<= t_1 (- INFINITY))
     t_0
     (if (<= t_1 -4e-320)
       t_1
       (if (<= t_1 0.0)
         t_0
         (if (<= t_1 5e+304) t_1 (sqrt (* (/ (* A c0) l) (/ c0 V)))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = c0 * (sqrt((A / V)) / sqrt(l));
	double t_1 = c0 * sqrt((A / (V * l)));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = t_0;
	} else if (t_1 <= -4e-320) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = t_0;
	} else if (t_1 <= 5e+304) {
		tmp = t_1;
	} else {
		tmp = sqrt((((A * c0) / l) * (c0 / V)));
	}
	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)) / Math.sqrt(l));
	double t_1 = c0 * Math.sqrt((A / (V * l)));
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = t_0;
	} else if (t_1 <= -4e-320) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = t_0;
	} else if (t_1 <= 5e+304) {
		tmp = t_1;
	} else {
		tmp = Math.sqrt((((A * c0) / l) * (c0 / V)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	t_0 = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	t_1 = c0 * math.sqrt((A / (V * l)))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = t_0
	elif t_1 <= -4e-320:
		tmp = t_1
	elif t_1 <= 0.0:
		tmp = t_0
	elif t_1 <= 5e+304:
		tmp = t_1
	else:
		tmp = math.sqrt((((A * c0) / l) * (c0 / V)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	t_0 = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)))
	t_1 = Float64(c0 * sqrt(Float64(A / Float64(V * l))))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = t_0;
	elseif (t_1 <= -4e-320)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = t_0;
	elseif (t_1 <= 5e+304)
		tmp = t_1;
	else
		tmp = sqrt(Float64(Float64(Float64(A * c0) / l) * Float64(c0 / V)));
	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));
	t_1 = c0 * sqrt((A / (V * l)));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = t_0;
	elseif (t_1 <= -4e-320)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = t_0;
	elseif (t_1 <= 5e+304)
		tmp = t_1;
	else
		tmp = sqrt((((A * c0) / l) * (c0 / V)));
	end
	tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$0, If[LessEqual[t$95$1, -4e-320], t$95$1, If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 5e+304], t$95$1, N[Sqrt[N[(N[(N[(A * c0), $MachinePrecision] / l), $MachinePrecision] * N[(c0 / V), $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}}\\
t_1 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_0\\

\mathbf{elif}\;t_1 \leq -4 \cdot 10^{-320}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_0\\

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

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


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

    1. Initial program 41.1%

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

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

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

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

    if -inf.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < -3.99996e-320 or -0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.9999999999999997e304

    1. Initial program 99.2%

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

    if 4.9999999999999997e304 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 46.9%

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

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

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

        \[\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}} \]
      4. *-commutative46.9%

        \[\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} \]
      5. *-commutative46.9%

        \[\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} \]
      6. swap-sqr45.9%

        \[\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} \]
      7. add-sqr-sqrt45.9%

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

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

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

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

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

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

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

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

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

Alternative 3: 83.1% accurate, 0.2× speedup?

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

\mathbf{elif}\;t_1 \leq -4 \cdot 10^{-320}:\\
\;\;\;\;t_1\\

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

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

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


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

    1. Initial program 44.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < -3.99996e-320 or -0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.9999999999999997e304

    1. Initial program 99.2%

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

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

    1. Initial program 40.0%

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

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

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

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

    if 4.9999999999999997e304 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 46.9%

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

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

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

        \[\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}} \]
      4. *-commutative46.9%

        \[\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} \]
      5. *-commutative46.9%

        \[\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} \]
      6. swap-sqr45.9%

        \[\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} \]
      7. add-sqr-sqrt45.9%

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

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

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

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

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

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

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

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

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

Alternative 4: 80.4% accurate, 0.2× speedup?

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

\mathbf{elif}\;t_0 \leq 4 \cdot 10^{-233}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < -4.99999999999999981e-292 or 3.99999999999999983e-233 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.9999999999999997e304

    1. Initial program 91.3%

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

    if -4.99999999999999981e-292 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 3.99999999999999983e-233

    1. Initial program 47.3%

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

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

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

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

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

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

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

    if 4.9999999999999997e304 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 46.9%

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

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

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

        \[\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}} \]
      4. *-commutative46.9%

        \[\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} \]
      5. *-commutative46.9%

        \[\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} \]
      6. swap-sqr45.9%

        \[\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} \]
      7. add-sqr-sqrt45.9%

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

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

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

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

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

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

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

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

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

Alternative 5: 80.4% accurate, 0.2× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < -4.99999999999999981e-292 or 3.99999999999999983e-233 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.9999999999999997e304

    1. Initial program 91.3%

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

    if -4.99999999999999981e-292 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 3.99999999999999983e-233

    1. Initial program 47.3%

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

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

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

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

    if 4.9999999999999997e304 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 46.9%

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

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

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

        \[\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}} \]
      4. *-commutative46.9%

        \[\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} \]
      5. *-commutative46.9%

        \[\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} \]
      6. swap-sqr45.9%

        \[\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} \]
      7. add-sqr-sqrt45.9%

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

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

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

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

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

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

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

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

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

Alternative 6: 91.0% accurate, 0.3× speedup?

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

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


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

    1. Initial program 73.0%

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < A

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

Alternative 7: 90.0% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{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) < -inf.0

    1. Initial program 46.7%

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

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

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

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

    if -inf.0 < (*.f64 V l) < -2e-281

    1. Initial program 85.2%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. frac-2neg85.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 -2e-281 < (*.f64 V l) < 0.0

    1. Initial program 53.8%

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}}\right)} - 1 \]
      4. *-un-lft-identity32.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}}\right)} - 1 \]
      5. associate-/r*35.8%

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}\right)} - 1 \]
      7. clear-num18.8%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      8. un-div-inv18.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      9. sqrt-undiv35.8%

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

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

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

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

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

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

    if 0.0 < (*.f64 V l)

    1. Initial program 77.6%

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

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

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

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

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

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

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

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

Alternative 8: 83.3% accurate, 0.5× speedup?

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

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


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

    1. Initial program 73.0%

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

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

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

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

    if -1.9999999999999e-311 < A

    1. Initial program 74.1%

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

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

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

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

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

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

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

Alternative 9: 84.7% accurate, 0.5× speedup?

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

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


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

    1. Initial program 73.0%

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

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

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

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

    if -1.9999999999999e-311 < A

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

Alternative 10: 80.0% accurate, 0.9× speedup?

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

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

\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)) < 1.99999997e-317

    1. Initial program 39.4%

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

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

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

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

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

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

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

    if 1.99999997e-317 < (/.f64 A (*.f64 V l)) < 5.00000000000000029e278

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000029e278 < (/.f64 A (*.f64 V l))

    1. Initial program 45.4%

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}}\right)} - 1 \]
      4. *-un-lft-identity23.6%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}}\right)} - 1 \]
      5. associate-/r*25.4%

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}\right)} - 1 \]
      7. clear-num19.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      8. un-div-inv19.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      9. sqrt-undiv26.8%

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

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

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

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

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

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

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

Alternative 11: 79.9% accurate, 0.9× speedup?

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

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


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

    1. Initial program 41.4%

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

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

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

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

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

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

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

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

    1. Initial program 99.3%

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

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

Alternative 12: 80.4% accurate, 0.9× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+278}:\\ \;\;\;\;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 l) V)))
     (if (<= t_0 5e+278) (* 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 / l) / V));
	} else if (t_0 <= 5e+278) {
		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 / l) / v))
    else if (t_0 <= 5d+278) 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 / l) / V));
	} else if (t_0 <= 5e+278) {
		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 / l) / V))
	elif t_0 <= 5e+278:
		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 / l) / V)));
	elseif (t_0 <= 5e+278)
		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 / l) / V));
	elseif (t_0 <= 5e+278)
		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 / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+278], 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}{\ell}}{V}}\\

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

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

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

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

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

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

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

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

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

    1. Initial program 99.3%

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

    if 5.00000000000000029e278 < (/.f64 A (*.f64 V l))

    1. Initial program 45.4%

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}}\right)} - 1 \]
      4. *-un-lft-identity23.6%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}}\right)} - 1 \]
      5. associate-/r*25.4%

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}\right)} - 1 \]
      7. clear-num19.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      8. un-div-inv19.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      9. sqrt-undiv26.8%

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

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

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

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

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

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

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

Alternative 13: 80.0% accurate, 0.9× speedup?

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

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

\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)) < 1.99999997e-317

    1. Initial program 39.4%

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

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

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

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

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

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

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

    if 1.99999997e-317 < (/.f64 A (*.f64 V l)) < 5.00000000000000029e278

    1. Initial program 99.6%

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}}\right)} - 1 \]
      4. *-un-lft-identity26.7%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}}\right)} - 1 \]
      5. associate-/r*24.9%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      8. un-div-inv10.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      9. sqrt-undiv24.9%

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

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

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

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

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

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

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

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

    if 5.00000000000000029e278 < (/.f64 A (*.f64 V l))

    1. Initial program 45.4%

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\color{blue}{\frac{1 \cdot A}{V \cdot \ell}}}\right)} - 1 \]
      4. *-un-lft-identity23.6%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \sqrt{\frac{\color{blue}{A}}{V \cdot \ell}}\right)} - 1 \]
      5. associate-/r*25.4%

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}\right)} - 1 \]
      7. clear-num19.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      8. un-div-inv19.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}\right)} - 1 \]
      9. sqrt-undiv26.8%

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

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

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

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

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

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

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

Alternative 14: 74.4% accurate, 1.0× speedup?

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

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

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

Reproduce

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