Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.2% → 89.8%
Time: 11.9s
Alternatives: 13
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 13 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.2% accurate, 1.0× speedup?

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

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

Alternative 1: 89.8% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;A \leq 6.8 \cdot 10^{+218}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{1}{\ell}}{\frac{V}{A}}}\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{\frac{1}{V}}{\ell}}\right)\\


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

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000023e-311 < A < 2.79999999999999992e-126

    1. Initial program 76.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.79999999999999992e-126 < A < 6.80000000000000017e218

    1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

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

    if 6.80000000000000017e218 < A

    1. Initial program 73.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -5 \cdot 10^{-311}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\frac{\sqrt{-A}}{\sqrt{-V}}}}\\ \mathbf{elif}\;A \leq 2.8 \cdot 10^{-126}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell \cdot V}}{\sqrt{A}}}\\ \mathbf{elif}\;A \leq 6.8 \cdot 10^{+218}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{1}{\ell}}{\frac{V}{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{\frac{1}{V}}{\ell}}\right)\\ \end{array} \]

Alternative 2: 77.2% accurate, 0.3× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{\ell \cdot V}}\\ \mathbf{if}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 10^{+212}\right):\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
NOTE: c0, A, 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 (* l V))))))
   (if (or (<= t_0 0.0) (not (<= t_0 1e+212)))
     (* c0 (sqrt (/ (/ A V) l)))
     t_0)))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = c0 * sqrt((A / (l * V)));
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 1e+212)) {
		tmp = c0 * sqrt(((A / V) / l));
	} else {
		tmp = t_0;
	}
	return tmp;
}
NOTE: c0, A, 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 / (l * v)))
    if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 1d+212))) then
        tmp = c0 * sqrt(((a / v) / l))
    else
        tmp = t_0
    end if
    code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = c0 * Math.sqrt((A / (l * V)));
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 1e+212)) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else {
		tmp = t_0;
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	t_0 = c0 * math.sqrt((A / (l * V)))
	tmp = 0
	if (t_0 <= 0.0) or not (t_0 <= 1e+212):
		tmp = c0 * math.sqrt(((A / V) / l))
	else:
		tmp = t_0
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	t_0 = Float64(c0 * sqrt(Float64(A / Float64(l * V))))
	tmp = 0.0
	if ((t_0 <= 0.0) || !(t_0 <= 1e+212))
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	else
		tmp = t_0;
	end
	return tmp
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
	t_0 = c0 * sqrt((A / (l * V)));
	tmp = 0.0;
	if ((t_0 <= 0.0) || ~((t_0 <= 1e+212)))
		tmp = c0 * sqrt(((A / V) / l));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
NOTE: c0, A, 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[(l * V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 1e+212]], $MachinePrecision]], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \sqrt{\frac{A}{\ell \cdot V}}\\
\mathbf{if}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 10^{+212}\right):\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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


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

    1. Initial program 67.7%

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

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

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

    if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 9.9999999999999991e211

    1. Initial program 99.0%

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

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

Alternative 3: 77.5% accurate, 0.3× speedup?

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

\mathbf{elif}\;t_0 \leq 10^{+232}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 69.5%

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

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

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

    if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.00000000000000006e232

    1. Initial program 99.1%

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

    if 1.00000000000000006e232 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 55.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 77.4% accurate, 0.3× speedup?

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

\mathbf{elif}\;t_0 \leq 10^{+232}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 70.0%

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

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

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

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

    if 5e-297 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.00000000000000006e232

    1. Initial program 99.0%

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

    if 1.00000000000000006e232 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 55.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 84.8% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 62.5%

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

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

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

    if -1e133 < (*.f64 V l) < -9.99999999999999952e-178

    1. Initial program 91.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\frac{\color{blue}{\sqrt{\ell \cdot \left(-V\right)}}}{\sqrt{-A}}} \]
      10. un-div-inv99.4%

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

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell \cdot \left(-V\right)}{-A}}}} \]
      12. distribute-rgt-neg-out93.8%

        \[\leadsto \frac{c0}{\sqrt{\frac{\color{blue}{-\ell \cdot V}}{-A}}} \]
      13. distribute-lft-neg-in93.8%

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

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

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

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

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

    if -9.99999999999999952e-178 < (*.f64 V l) < 5e-297

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c0 \cdot \frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\right)\right)} \]
      9. div-inv29.4%

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

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

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

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

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

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

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

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

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

    if 5e-297 < (*.f64 V l) < 3.99999999999999981e247

    1. Initial program 87.5%

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

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

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

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

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

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

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

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

    if 3.99999999999999981e247 < (*.f64 V l)

    1. Initial program 45.2%

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

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

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

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

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

Alternative 6: 87.9% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;\ell \cdot V \leq 0:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -9.9999999999999992e124 or -9.99999999999999954e-163 < (*.f64 V l) < -0.0

    1. Initial program 57.3%

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

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

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

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

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

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

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

    if -9.9999999999999992e124 < (*.f64 V l) < -9.99999999999999954e-163

    1. Initial program 95.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\frac{\color{blue}{\sqrt{\ell \cdot \left(-V\right)}}}{\sqrt{-A}}} \]
      10. un-div-inv99.4%

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

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell \cdot \left(-V\right)}{-A}}}} \]
      12. distribute-rgt-neg-out97.4%

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 3.99999999999999981e247

    1. Initial program 88.0%

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

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

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

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

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

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

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

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

    if 3.99999999999999981e247 < (*.f64 V l)

    1. Initial program 45.2%

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

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

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

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

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

Alternative 7: 87.9% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;\ell \cdot V \leq 0:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -9.9999999999999992e124 or -9.99999999999999954e-163 < (*.f64 V l) < -0.0

    1. Initial program 57.3%

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

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

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

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

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

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

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

    if -9.9999999999999992e124 < (*.f64 V l) < -9.99999999999999954e-163

    1. Initial program 95.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\frac{\color{blue}{\sqrt{\ell \cdot \left(-V\right)}}}{\sqrt{-A}}} \]
      10. un-div-inv99.4%

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

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell \cdot \left(-V\right)}{-A}}}} \]
      12. distribute-rgt-neg-out97.4%

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 3.99999999999999981e247

    1. Initial program 88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999981e247 < (*.f64 V l)

    1. Initial program 45.2%

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

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

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

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

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

Alternative 8: 87.2% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;\ell \cdot V \leq 0:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -9.99999999999999907e186 or -9.99999999999999954e-163 < (*.f64 V l) < -0.0

    1. Initial program 51.9%

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

        \[\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. associate-*r/37.7%

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

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

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

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

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

    if -9.99999999999999907e186 < (*.f64 V l) < -9.99999999999999954e-163

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\frac{\color{blue}{\sqrt{\ell \cdot \left(-V\right)}}}{\sqrt{-A}}} \]
      10. un-div-inv99.4%

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

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell \cdot \left(-V\right)}{-A}}}} \]
      12. distribute-rgt-neg-out94.7%

        \[\leadsto \frac{c0}{\sqrt{\frac{\color{blue}{-\ell \cdot V}}{-A}}} \]
      13. distribute-lft-neg-in94.7%

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 3.99999999999999981e247

    1. Initial program 88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999981e247 < (*.f64 V l)

    1. Initial program 45.2%

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

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

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

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

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

Alternative 9: 90.5% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 43.8%

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

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

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

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

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

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

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

    if -2.00000000000000013e294 < (*.f64 V l) < -9.99999999999999954e-213

    1. Initial program 86.5%

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

        \[\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. distribute-rgt-neg-in99.3%

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

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

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

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

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

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

    if -9.99999999999999954e-213 < (*.f64 V l) < -0.0

    1. Initial program 49.5%

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 3.99999999999999981e247

    1. Initial program 88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999981e247 < (*.f64 V l)

    1. Initial program 45.2%

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

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

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

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

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

Alternative 10: 82.7% accurate, 0.5× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{A}{V}}\\ t_1 := \frac{\frac{1}{V}}{\ell}\\ \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{t_1}\right)\\ \mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+68}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{t_0}}\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+187}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{\frac{\sqrt{\ell}}{c0}}\\ \end{array} \end{array} \]
NOTE: c0, A, 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 (/ (/ 1.0 V) l)))
   (if (<= l -5e-310)
     (* c0 (* (sqrt A) (sqrt t_1)))
     (if (<= l 2.6e+68)
       (/ c0 (/ (sqrt l) t_0))
       (if (<= l 8.5e+187) (* c0 (sqrt (* A t_1))) (/ t_0 (/ (sqrt l) c0)))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = sqrt((A / V));
	double t_1 = (1.0 / V) / l;
	double tmp;
	if (l <= -5e-310) {
		tmp = c0 * (sqrt(A) * sqrt(t_1));
	} else if (l <= 2.6e+68) {
		tmp = c0 / (sqrt(l) / t_0);
	} else if (l <= 8.5e+187) {
		tmp = c0 * sqrt((A * t_1));
	} else {
		tmp = t_0 / (sqrt(l) / c0);
	}
	return tmp;
}
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((a / v))
    t_1 = (1.0d0 / v) / l
    if (l <= (-5d-310)) then
        tmp = c0 * (sqrt(a) * sqrt(t_1))
    else if (l <= 2.6d+68) then
        tmp = c0 / (sqrt(l) / t_0)
    else if (l <= 8.5d+187) then
        tmp = c0 * sqrt((a * t_1))
    else
        tmp = t_0 / (sqrt(l) / c0)
    end if
    code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = Math.sqrt((A / V));
	double t_1 = (1.0 / V) / l;
	double tmp;
	if (l <= -5e-310) {
		tmp = c0 * (Math.sqrt(A) * Math.sqrt(t_1));
	} else if (l <= 2.6e+68) {
		tmp = c0 / (Math.sqrt(l) / t_0);
	} else if (l <= 8.5e+187) {
		tmp = c0 * Math.sqrt((A * t_1));
	} else {
		tmp = t_0 / (Math.sqrt(l) / c0);
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	t_0 = math.sqrt((A / V))
	t_1 = (1.0 / V) / l
	tmp = 0
	if l <= -5e-310:
		tmp = c0 * (math.sqrt(A) * math.sqrt(t_1))
	elif l <= 2.6e+68:
		tmp = c0 / (math.sqrt(l) / t_0)
	elif l <= 8.5e+187:
		tmp = c0 * math.sqrt((A * t_1))
	else:
		tmp = t_0 / (math.sqrt(l) / c0)
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	t_0 = sqrt(Float64(A / V))
	t_1 = Float64(Float64(1.0 / V) / l)
	tmp = 0.0
	if (l <= -5e-310)
		tmp = Float64(c0 * Float64(sqrt(A) * sqrt(t_1)));
	elseif (l <= 2.6e+68)
		tmp = Float64(c0 / Float64(sqrt(l) / t_0));
	elseif (l <= 8.5e+187)
		tmp = Float64(c0 * sqrt(Float64(A * t_1)));
	else
		tmp = Float64(t_0 / Float64(sqrt(l) / c0));
	end
	return tmp
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
	t_0 = sqrt((A / V));
	t_1 = (1.0 / V) / l;
	tmp = 0.0;
	if (l <= -5e-310)
		tmp = c0 * (sqrt(A) * sqrt(t_1));
	elseif (l <= 2.6e+68)
		tmp = c0 / (sqrt(l) / t_0);
	elseif (l <= 8.5e+187)
		tmp = c0 * sqrt((A * t_1));
	else
		tmp = t_0 / (sqrt(l) / c0);
	end
	tmp_2 = tmp;
end
NOTE: c0, A, 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[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e+68], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e+187], N[(c0 * N[Sqrt[N[(A * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(N[Sqrt[l], $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{A}{V}}\\
t_1 := \frac{\frac{1}{V}}{\ell}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{t_1}\right)\\

\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+68}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{t_0}}\\

\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+187}:\\
\;\;\;\;c0 \cdot \sqrt{A \cdot t_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_0}{\frac{\sqrt{\ell}}{c0}}\\


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

    1. Initial program 75.3%

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

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

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

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

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

    if -4.999999999999985e-310 < l < 2.5999999999999998e68

    1. Initial program 68.0%

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

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

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

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

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

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

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

    if 2.5999999999999998e68 < l < 8.49999999999999989e187

    1. Initial program 85.1%

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

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

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

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

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

    if 8.49999999999999989e187 < l

    1. Initial program 54.9%

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

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

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

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

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

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

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

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

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

Alternative 11: 82.7% accurate, 0.5× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{A}{V}}\\ t_1 := \frac{\frac{1}{V}}{\ell}\\ \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{t_1}\right)\\ \mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+68}:\\ \;\;\;\;c0 \cdot \frac{1}{\frac{\sqrt{\ell}}{t_0}}\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+187}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{\frac{\sqrt{\ell}}{c0}}\\ \end{array} \end{array} \]
NOTE: c0, A, 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 (/ (/ 1.0 V) l)))
   (if (<= l -5e-310)
     (* c0 (* (sqrt A) (sqrt t_1)))
     (if (<= l 3.2e+68)
       (* c0 (/ 1.0 (/ (sqrt l) t_0)))
       (if (<= l 8.5e+187) (* c0 (sqrt (* A t_1))) (/ t_0 (/ (sqrt l) c0)))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = sqrt((A / V));
	double t_1 = (1.0 / V) / l;
	double tmp;
	if (l <= -5e-310) {
		tmp = c0 * (sqrt(A) * sqrt(t_1));
	} else if (l <= 3.2e+68) {
		tmp = c0 * (1.0 / (sqrt(l) / t_0));
	} else if (l <= 8.5e+187) {
		tmp = c0 * sqrt((A * t_1));
	} else {
		tmp = t_0 / (sqrt(l) / c0);
	}
	return tmp;
}
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((a / v))
    t_1 = (1.0d0 / v) / l
    if (l <= (-5d-310)) then
        tmp = c0 * (sqrt(a) * sqrt(t_1))
    else if (l <= 3.2d+68) then
        tmp = c0 * (1.0d0 / (sqrt(l) / t_0))
    else if (l <= 8.5d+187) then
        tmp = c0 * sqrt((a * t_1))
    else
        tmp = t_0 / (sqrt(l) / c0)
    end if
    code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = Math.sqrt((A / V));
	double t_1 = (1.0 / V) / l;
	double tmp;
	if (l <= -5e-310) {
		tmp = c0 * (Math.sqrt(A) * Math.sqrt(t_1));
	} else if (l <= 3.2e+68) {
		tmp = c0 * (1.0 / (Math.sqrt(l) / t_0));
	} else if (l <= 8.5e+187) {
		tmp = c0 * Math.sqrt((A * t_1));
	} else {
		tmp = t_0 / (Math.sqrt(l) / c0);
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	t_0 = math.sqrt((A / V))
	t_1 = (1.0 / V) / l
	tmp = 0
	if l <= -5e-310:
		tmp = c0 * (math.sqrt(A) * math.sqrt(t_1))
	elif l <= 3.2e+68:
		tmp = c0 * (1.0 / (math.sqrt(l) / t_0))
	elif l <= 8.5e+187:
		tmp = c0 * math.sqrt((A * t_1))
	else:
		tmp = t_0 / (math.sqrt(l) / c0)
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	t_0 = sqrt(Float64(A / V))
	t_1 = Float64(Float64(1.0 / V) / l)
	tmp = 0.0
	if (l <= -5e-310)
		tmp = Float64(c0 * Float64(sqrt(A) * sqrt(t_1)));
	elseif (l <= 3.2e+68)
		tmp = Float64(c0 * Float64(1.0 / Float64(sqrt(l) / t_0)));
	elseif (l <= 8.5e+187)
		tmp = Float64(c0 * sqrt(Float64(A * t_1)));
	else
		tmp = Float64(t_0 / Float64(sqrt(l) / c0));
	end
	return tmp
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
	t_0 = sqrt((A / V));
	t_1 = (1.0 / V) / l;
	tmp = 0.0;
	if (l <= -5e-310)
		tmp = c0 * (sqrt(A) * sqrt(t_1));
	elseif (l <= 3.2e+68)
		tmp = c0 * (1.0 / (sqrt(l) / t_0));
	elseif (l <= 8.5e+187)
		tmp = c0 * sqrt((A * t_1));
	else
		tmp = t_0 / (sqrt(l) / c0);
	end
	tmp_2 = tmp;
end
NOTE: c0, A, 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[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.2e+68], N[(c0 * N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e+187], N[(c0 * N[Sqrt[N[(A * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(N[Sqrt[l], $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{A}{V}}\\
t_1 := \frac{\frac{1}{V}}{\ell}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{t_1}\right)\\

\mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+68}:\\
\;\;\;\;c0 \cdot \frac{1}{\frac{\sqrt{\ell}}{t_0}}\\

\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+187}:\\
\;\;\;\;c0 \cdot \sqrt{A \cdot t_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_0}{\frac{\sqrt{\ell}}{c0}}\\


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

    1. Initial program 75.3%

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

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

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

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

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

    if -4.999999999999985e-310 < l < 3.19999999999999994e68

    1. Initial program 68.0%

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

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

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

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

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

    if 3.19999999999999994e68 < l < 8.49999999999999989e187

    1. Initial program 85.1%

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

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

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

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

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

    if 8.49999999999999989e187 < l

    1. Initial program 54.9%

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

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

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

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

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

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

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

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

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

Alternative 12: 80.5% accurate, 0.9× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := \frac{A}{\ell \cdot V}\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-267}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+304}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell \cdot V}{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\ \end{array} \end{array} \]
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (/ A (* l V))))
   (if (<= t_0 5e-267)
     (* c0 (sqrt (/ (/ A V) l)))
     (if (<= t_0 2e+304)
       (/ c0 (sqrt (/ (* l V) A)))
       (* c0 (pow (* l (/ V A)) -0.5))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double tmp;
	if (t_0 <= 5e-267) {
		tmp = c0 * sqrt(((A / V) / l));
	} else if (t_0 <= 2e+304) {
		tmp = c0 / sqrt(((l * V) / A));
	} else {
		tmp = c0 * pow((l * (V / A)), -0.5);
	}
	return tmp;
}
NOTE: c0, A, 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 / (l * v)
    if (t_0 <= 5d-267) then
        tmp = c0 * sqrt(((a / v) / l))
    else if (t_0 <= 2d+304) then
        tmp = c0 / sqrt(((l * v) / a))
    else
        tmp = c0 * ((l * (v / a)) ** (-0.5d0))
    end if
    code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double tmp;
	if (t_0 <= 5e-267) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else if (t_0 <= 2e+304) {
		tmp = c0 / Math.sqrt(((l * V) / A));
	} else {
		tmp = c0 * Math.pow((l * (V / A)), -0.5);
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	t_0 = A / (l * V)
	tmp = 0
	if t_0 <= 5e-267:
		tmp = c0 * math.sqrt(((A / V) / l))
	elif t_0 <= 2e+304:
		tmp = c0 / math.sqrt(((l * V) / A))
	else:
		tmp = c0 * math.pow((l * (V / A)), -0.5)
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	t_0 = Float64(A / Float64(l * V))
	tmp = 0.0
	if (t_0 <= 5e-267)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	elseif (t_0 <= 2e+304)
		tmp = Float64(c0 / sqrt(Float64(Float64(l * V) / A)));
	else
		tmp = Float64(c0 * (Float64(l * Float64(V / A)) ^ -0.5));
	end
	return tmp
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
	t_0 = A / (l * V);
	tmp = 0.0;
	if (t_0 <= 5e-267)
		tmp = c0 * sqrt(((A / V) / l));
	elseif (t_0 <= 2e+304)
		tmp = c0 / sqrt(((l * V) / A));
	else
		tmp = c0 * ((l * (V / A)) ^ -0.5);
	end
	tmp_2 = tmp;
end
NOTE: c0, A, 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[(l * V), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-267], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+304], N[(c0 / N[Sqrt[N[(N[(l * V), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Power[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-267}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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

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


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

    1. Initial program 44.6%

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

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

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

    if 4.9999999999999999e-267 < (/.f64 A (*.f64 V l)) < 1.9999999999999999e304

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\frac{\color{blue}{\sqrt{\ell \cdot \left(-V\right)}}}{\sqrt{-A}}} \]
      10. un-div-inv53.4%

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

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell \cdot \left(-V\right)}{-A}}}} \]
      12. distribute-rgt-neg-out99.3%

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

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

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

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

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

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

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

    1. Initial program 43.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{\color{blue}{\left(-V\right) \cdot \ell}}{-A}}} \]
      11. distribute-lft-neg-out45.1%

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{V \cdot \frac{\ell}{A}}}} \]
      14. pow1/260.0%

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

        \[\leadsto c0 \cdot \color{blue}{{\left(V \cdot \frac{\ell}{A}\right)}^{\left(-0.5\right)}} \]
      16. *-commutative60.0%

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

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

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

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

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

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

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

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

Alternative 13: 74.2% accurate, 1.0× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ c0 \cdot \sqrt{\frac{A}{\ell \cdot V}} \end{array} \]
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* l V)))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	return c0 * sqrt((A / (l * V)));
}
NOTE: c0, A, 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 / (l * v)))
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	return c0 * Math.sqrt((A / (l * V)));
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (l * V)))
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	return Float64(c0 * sqrt(Float64(A / Float64(l * V))))
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp = code(c0, A, V, l)
	tmp = c0 * sqrt((A / (l * V)));
end
NOTE: c0, A, 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[(l * V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{\ell \cdot V}}
\end{array}
Derivation
  1. Initial program 73.0%

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

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

Reproduce

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