Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.5% → 90.9%
Time: 12.4s
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: 73.5% accurate, 1.0× speedup?

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

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

Alternative 1: 90.9% accurate, 0.3× speedup?

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

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

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

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

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


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

    1. Initial program 43.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -2.00000000000000004e-287

    1. Initial program 77.9%

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

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

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

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

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

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

    if -2.00000000000000004e-287 < (*.f64 V l) < -0.0

    1. Initial program 39.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999994e304

    1. Initial program 87.6%

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

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

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

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

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

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

    if 9.9999999999999994e304 < (*.f64 V l)

    1. Initial program 15.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 76.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}{V \cdot \ell}}\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{-171} \lor \neg \left(t\_0 \leq 5 \cdot 10^{+266}\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 (* V l))))))
   (if (or (<= t_0 5e-171) (not (<= t_0 5e+266)))
     (* 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 / (V * l)));
	double tmp;
	if ((t_0 <= 5e-171) || !(t_0 <= 5e+266)) {
		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 / (v * l)))
    if ((t_0 <= 5d-171) .or. (.not. (t_0 <= 5d+266))) 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 / (V * l)));
	double tmp;
	if ((t_0 <= 5e-171) || !(t_0 <= 5e+266)) {
		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 / (V * l)))
	tmp = 0
	if (t_0 <= 5e-171) or not (t_0 <= 5e+266):
		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(V * l))))
	tmp = 0.0
	if ((t_0 <= 5e-171) || !(t_0 <= 5e+266))
		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 / (V * l)));
	tmp = 0.0;
	if ((t_0 <= 5e-171) || ~((t_0 <= 5e+266)))
		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[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 5e-171], N[Not[LessEqual[t$95$0, 5e+266]], $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}{V \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-171} \lor \neg \left(t\_0 \leq 5 \cdot 10^{+266}\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)))) < 4.99999999999999992e-171 or 4.9999999999999999e266 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 65.1%

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

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

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

      \[\leadsto \color{blue}{c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}} \]
    4. Add Preprocessing

    if 4.99999999999999992e-171 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.9999999999999999e266

    1. Initial program 98.5%

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

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

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

\mathbf{elif}\;t\_0 \leq 10^{+285}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\

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


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

    1. Initial program 67.3%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 67.3%

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

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

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

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

    if 4.9999999999999998e-235 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 9.9999999999999998e284

    1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999998e284 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \leq 5 \cdot 10^{-235}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \leq 10^{+285}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 76.6% 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}{V \cdot \ell}}\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{-261}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+260}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{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 (* V l))))))
   (if (<= t_0 5e-261)
     (* c0 (sqrt (/ (/ A l) V)))
     (if (<= t_0 4e+260) t_0 (/ c0 (sqrt (* V (/ l A))))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = c0 * sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 5e-261) {
		tmp = c0 * sqrt(((A / l) / V));
	} else if (t_0 <= 4e+260) {
		tmp = t_0;
	} else {
		tmp = c0 / sqrt((V * (l / 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 / (v * l)))
    if (t_0 <= 5d-261) then
        tmp = c0 * sqrt(((a / l) / v))
    else if (t_0 <= 4d+260) then
        tmp = t_0
    else
        tmp = c0 / sqrt((v * (l / 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 / (V * l)));
	double tmp;
	if (t_0 <= 5e-261) {
		tmp = c0 * Math.sqrt(((A / l) / V));
	} else if (t_0 <= 4e+260) {
		tmp = t_0;
	} else {
		tmp = c0 / Math.sqrt((V * (l / A)));
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	t_0 = c0 * math.sqrt((A / (V * l)))
	tmp = 0
	if t_0 <= 5e-261:
		tmp = c0 * math.sqrt(((A / l) / V))
	elif t_0 <= 4e+260:
		tmp = t_0
	else:
		tmp = c0 / math.sqrt((V * (l / 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(V * l))))
	tmp = 0.0
	if (t_0 <= 5e-261)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V)));
	elseif (t_0 <= 4e+260)
		tmp = t_0;
	else
		tmp = Float64(c0 / sqrt(Float64(V * Float64(l / 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 / (V * l)));
	tmp = 0.0;
	if (t_0 <= 5e-261)
		tmp = c0 * sqrt(((A / l) / V));
	elseif (t_0 <= 4e+260)
		tmp = t_0;
	else
		tmp = c0 / sqrt((V * (l / 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[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-261], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+260], t$95$0, N[(c0 / N[Sqrt[N[(V * N[(l / 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}{V \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-261}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+260}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 67.3%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 67.3%

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

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

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

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

    if 4.99999999999999981e-261 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.00000000000000026e260

    1. Initial program 98.6%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing

    if 4.00000000000000026e260 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 51.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \leq 5 \cdot 10^{-261}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \leq 4 \cdot 10^{+260}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
  5. Add Preprocessing

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

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+266}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 67.3%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 67.3%

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

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

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

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

    if 4.99999999999999981e-261 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.9999999999999999e266

    1. Initial program 98.6%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing

    if 4.9999999999999999e266 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 48.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \leq 5 \cdot 10^{-261}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \leq 5 \cdot 10^{+266}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \]
  5. Add Preprocessing

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

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot {\ell}^{-0.5}}{t\_0}\\


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

    1. Initial program 43.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -2.00000000000000004e-287

    1. Initial program 77.9%

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

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

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

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

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

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

    if -2.00000000000000004e-287 < (*.f64 V l) < -0.0

    1. Initial program 39.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999994e304

    1. Initial program 87.6%

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

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

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

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

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

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

    if 9.9999999999999994e304 < (*.f64 V l)

    1. Initial program 15.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\color{blue}{\left(\sqrt{\left(-\ell\right) \cdot \left(-\ell\right)}\right)}}^{\left(-0.5\right)} \cdot \frac{c0}{\sqrt{\frac{V}{A}}} \]
      13. sqr-neg27.0%

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

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

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

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

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

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

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

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

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

Alternative 7: 86.4% 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}} \cdot \frac{c0}{\sqrt{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+177}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0 \lor \neg \left(V \cdot \ell \leq 10^{+305}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \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)) (/ c0 (sqrt l)))))
   (if (<= (* V l) -5e+177)
     t_0
     (if (<= (* V l) -5e-121)
       (/ c0 (sqrt (/ (* V l) A)))
       (if (or (<= (* V l) 0.0) (not (<= (* V l) 1e+305)))
         t_0
         (* c0 (/ (sqrt A) (sqrt (* V l)))))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = sqrt((A / V)) * (c0 / sqrt(l));
	double tmp;
	if ((V * l) <= -5e+177) {
		tmp = t_0;
	} else if ((V * l) <= -5e-121) {
		tmp = c0 / sqrt(((V * l) / A));
	} else if (((V * l) <= 0.0) || !((V * l) <= 1e+305)) {
		tmp = t_0;
	} else {
		tmp = c0 * (sqrt(A) / sqrt((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) :: t_0
    real(8) :: tmp
    t_0 = sqrt((a / v)) * (c0 / sqrt(l))
    if ((v * l) <= (-5d+177)) then
        tmp = t_0
    else if ((v * l) <= (-5d-121)) then
        tmp = c0 / sqrt(((v * l) / a))
    else if (((v * l) <= 0.0d0) .or. (.not. ((v * l) <= 1d+305))) then
        tmp = t_0
    else
        tmp = c0 * (sqrt(a) / sqrt((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 t_0 = Math.sqrt((A / V)) * (c0 / Math.sqrt(l));
	double tmp;
	if ((V * l) <= -5e+177) {
		tmp = t_0;
	} else if ((V * l) <= -5e-121) {
		tmp = c0 / Math.sqrt(((V * l) / A));
	} else if (((V * l) <= 0.0) || !((V * l) <= 1e+305)) {
		tmp = t_0;
	} else {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	t_0 = math.sqrt((A / V)) * (c0 / math.sqrt(l))
	tmp = 0
	if (V * l) <= -5e+177:
		tmp = t_0
	elif (V * l) <= -5e-121:
		tmp = c0 / math.sqrt(((V * l) / A))
	elif ((V * l) <= 0.0) or not ((V * l) <= 1e+305):
		tmp = t_0
	else:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	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(c0 / sqrt(l)))
	tmp = 0.0
	if (Float64(V * l) <= -5e+177)
		tmp = t_0;
	elseif (Float64(V * l) <= -5e-121)
		tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A)));
	elseif ((Float64(V * l) <= 0.0) || !(Float64(V * l) <= 1e+305))
		tmp = t_0;
	else
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	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)) * (c0 / sqrt(l));
	tmp = 0.0;
	if ((V * l) <= -5e+177)
		tmp = t_0;
	elseif ((V * l) <= -5e-121)
		tmp = c0 / sqrt(((V * l) / A));
	elseif (((V * l) <= 0.0) || ~(((V * l) <= 1e+305)))
		tmp = t_0;
	else
		tmp = c0 * (sqrt(A) / sqrt((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_] := Block[{t$95$0 = N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -5e+177], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -5e-121], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[Not[LessEqual[N[(V * l), $MachinePrecision], 1e+305]], $MachinePrecision]], t$95$0, N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $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}} \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+177}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;V \cdot \ell \leq 0 \lor \neg \left(V \cdot \ell \leq 10^{+305}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 V l) < -5.0000000000000003e177 or -4.99999999999999989e-121 < (*.f64 V l) < -0.0 or 9.9999999999999994e304 < (*.f64 V l)

    1. Initial program 47.6%

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

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

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

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

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

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

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

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

    if -5.0000000000000003e177 < (*.f64 V l) < -4.99999999999999989e-121

    1. Initial program 89.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999994e304

    1. Initial program 87.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+177}:\\ \;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-121}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0 \lor \neg \left(V \cdot \ell \leq 10^{+305}\right):\\ \;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 81.5% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-253 < (*.f64 V l) < 4.0000049e-319

    1. Initial program 45.6%

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

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

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

      \[\leadsto \color{blue}{c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}} \]
    4. Add Preprocessing

    if 4.0000049e-319 < (*.f64 V l) < 9.9999999999999994e304

    1. Initial program 87.9%

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

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

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

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

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

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

    if 9.9999999999999994e304 < (*.f64 V l)

    1. Initial program 15.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 82.8% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-253 < (*.f64 V l) < 4.0000049e-319

    1. Initial program 45.6%

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

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

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

      \[\leadsto \color{blue}{c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}} \]
    4. Add Preprocessing

    if 4.0000049e-319 < (*.f64 V l) < 9.9999999999999996e297

    1. Initial program 87.8%

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

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

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

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

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

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

    if 9.9999999999999996e297 < (*.f64 V l)

    1. Initial program 25.2%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 25.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{-253}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-319}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+298}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 85.1% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot {\ell}^{-0.5}}{t\_0}\\


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

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999994e304

    1. Initial program 87.6%

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

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

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

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

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

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

    if 9.9999999999999994e304 < (*.f64 V l)

    1. Initial program 15.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\color{blue}{\left(\sqrt{\left(-\ell\right) \cdot \left(-\ell\right)}\right)}}^{\left(-0.5\right)} \cdot \frac{c0}{\sqrt{\frac{V}{A}}} \]
      13. sqr-neg27.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{c0 \cdot {\ell}^{-0.5}}{\sqrt{\frac{V}{A}}}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 11: 84.8% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999994e304

    1. Initial program 87.6%

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

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

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

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

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

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

    if 9.9999999999999994e304 < (*.f64 V l)

    1. Initial program 15.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 85.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999994e304

    1. Initial program 87.6%

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

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

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

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

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

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

    if 9.9999999999999994e304 < (*.f64 V l)

    1. Initial program 15.9%

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

        \[\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/74.7%

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

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

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

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

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

Alternative 13: 73.5% accurate, 1.0× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \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 (* V l)))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	return c0 * sqrt((A / (V * l)));
}
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 / (v * l)))
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 / (V * l)));
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	return Float64(c0 * sqrt(Float64(A / Float64(V * l))))
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp = code(c0, A, V, l)
	tmp = c0 * sqrt((A / (V * l)));
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[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Derivation
  1. Initial program 73.5%

    \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
  2. Add Preprocessing
  3. Add Preprocessing

Reproduce

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