Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.0% → 91.1%
Time: 10.2s
Alternatives: 9
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 9 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.0% accurate, 1.0× speedup?

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

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

Alternative 1: 91.1% 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 -\infty:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-314}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+251}:\\ \;\;\;\;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) (- INFINITY))
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (if (<= (* V l) -1e-314)
     (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
     (if (<= (* V l) 0.0)
       (* c0 (/ (sqrt (/ A (- l))) (sqrt (- V))))
       (if (<= (* V l) 2e+251)
         (* 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) <= -((double) INFINITY)) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else if ((V * l) <= -1e-314) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = c0 * (sqrt((A / -l)) / sqrt(-V));
	} else if ((V * l) <= 2e+251) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 * sqrt(((A / l) / 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.sqrt(l));
	} else if ((V * l) <= -1e-314) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = c0 * (Math.sqrt((A / -l)) / Math.sqrt(-V));
	} else if ((V * l) <= 2e+251) {
		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) <= -math.inf:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	elif (V * l) <= -1e-314:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 0.0:
		tmp = c0 * (math.sqrt((A / -l)) / math.sqrt(-V))
	elif (V * l) <= 2e+251:
		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) <= Float64(-Inf))
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	elseif (Float64(V * l) <= -1e-314)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 0.0)
		tmp = Float64(c0 * Float64(sqrt(Float64(A / Float64(-l))) / sqrt(Float64(-V))));
	elseif (Float64(V * l) <= 2e+251)
		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) <= -Inf)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	elseif ((V * l) <= -1e-314)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 0.0)
		tmp = c0 * (sqrt((A / -l)) / sqrt(-V));
	elseif ((V * l) <= 2e+251)
		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], (-Infinity)], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-314], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[N[(A / (-l)), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+251], 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 -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

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

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

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+251}:\\
\;\;\;\;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 5 regimes
  2. if (*.f64 V l) < -inf.0

    1. Initial program 23.1%

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -9.9999999996e-315

    1. Initial program 81.8%

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

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

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

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

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

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

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

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

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

    if -9.9999999996e-315 < (*.f64 V l) < 0.0

    1. Initial program 41.4%

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\ell \cdot \frac{V}{A}}}} \]
    5. Taylor expanded in l around 0 41.4%

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

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

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

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

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

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

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

    if 0.0 < (*.f64 V l) < 2.0000000000000001e251

    1. Initial program 84.3%

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

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

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

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

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

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

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

    if 2.0000000000000001e251 < (*.f64 V l)

    1. Initial program 40.7%

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\ell \cdot \frac{V}{A}}}} \]
    5. Taylor expanded in l around 0 40.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-314}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+251}:\\ \;\;\;\;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 2: 76.0% 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 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+206}:\\ \;\;\;\;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 0.0)
     (* c0 (sqrt (/ (/ A V) l)))
     (if (<= t_0 5e+206) 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 <= 0.0) {
		tmp = c0 * sqrt(((A / V) / l));
	} else if (t_0 <= 5e+206) {
		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 <= 0.0d0) then
        tmp = c0 * sqrt(((a / v) / l))
    else if (t_0 <= 5d+206) 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 <= 0.0) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else if (t_0 <= 5e+206) {
		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 <= 0.0:
		tmp = c0 * math.sqrt(((A / V) / l))
	elif t_0 <= 5e+206:
		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 <= 0.0)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	elseif (t_0 <= 5e+206)
		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 <= 0.0)
		tmp = c0 * sqrt(((A / V) / l));
	elseif (t_0 <= 5e+206)
		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, 0.0], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+206], 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 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+206}:\\
\;\;\;\;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)))) < 0.0

    1. Initial program 67.0%

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

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

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

    if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 5.0000000000000002e206

    1. Initial program 99.6%

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

    if 5.0000000000000002e206 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 59.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 67.0%

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

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

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

    if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 5.0000000000000002e206

    1. Initial program 99.6%

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

    if 5.0000000000000002e206 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 59.7%

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\ell \cdot \frac{V}{A}}}} \]
    5. Taylor expanded in l around 0 59.7%

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

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

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

Alternative 4: 86.6% 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 -\infty:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-314}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\sqrt{\frac{\frac{A}{V} \cdot {c0}^{2}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+251}:\\ \;\;\;\;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) (- INFINITY))
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (if (<= (* V l) -1e-314)
     (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
     (if (<= (* V l) 0.0)
       (sqrt (/ (* (/ A V) (pow c0 2.0)) l))
       (if (<= (* V l) 2e+251)
         (* 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) <= -((double) INFINITY)) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else if ((V * l) <= -1e-314) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = sqrt((((A / V) * pow(c0, 2.0)) / l));
	} else if ((V * l) <= 2e+251) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 * sqrt(((A / l) / 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.sqrt(l));
	} else if ((V * l) <= -1e-314) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = Math.sqrt((((A / V) * Math.pow(c0, 2.0)) / l));
	} else if ((V * l) <= 2e+251) {
		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) <= -math.inf:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	elif (V * l) <= -1e-314:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 0.0:
		tmp = math.sqrt((((A / V) * math.pow(c0, 2.0)) / l))
	elif (V * l) <= 2e+251:
		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) <= Float64(-Inf))
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	elseif (Float64(V * l) <= -1e-314)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 0.0)
		tmp = sqrt(Float64(Float64(Float64(A / V) * (c0 ^ 2.0)) / l));
	elseif (Float64(V * l) <= 2e+251)
		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) <= -Inf)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	elseif ((V * l) <= -1e-314)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 0.0)
		tmp = sqrt((((A / V) * (c0 ^ 2.0)) / l));
	elseif ((V * l) <= 2e+251)
		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], (-Infinity)], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-314], 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[Sqrt[N[(N[(N[(A / V), $MachinePrecision] * N[Power[c0, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+251], 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 -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

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

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

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+251}:\\
\;\;\;\;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 5 regimes
  2. if (*.f64 V l) < -inf.0

    1. Initial program 23.1%

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -9.9999999996e-315

    1. Initial program 81.8%

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

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

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

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

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

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

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

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

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

    if -9.9999999996e-315 < (*.f64 V l) < 0.0

    1. Initial program 41.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{\frac{A}{V} \cdot \color{blue}{{c0}^{2}}}{\sqrt{\ell} \cdot \sqrt{\ell}}} \]
      7. add-sqr-sqrt26.9%

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

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

    if 0.0 < (*.f64 V l) < 2.0000000000000001e251

    1. Initial program 84.3%

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

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

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

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

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

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

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

    if 2.0000000000000001e251 < (*.f64 V l)

    1. Initial program 40.7%

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\ell \cdot \frac{V}{A}}}} \]
    5. Taylor expanded in l around 0 40.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-314}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\sqrt{\frac{\frac{A}{V} \cdot {c0}^{2}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+251}:\\ \;\;\;\;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 5: 83.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^{+138}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+251}:\\ \;\;\;\;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+138)
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (if (<= (* V l) 0.0)
     (/ c0 (sqrt (* V (/ l A))))
     (if (<= (* V l) 2e+251)
       (* 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+138) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else if ((V * l) <= 0.0) {
		tmp = c0 / sqrt((V * (l / A)));
	} else if ((V * l) <= 2e+251) {
		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+138)) then
        tmp = c0 * (sqrt((a / v)) / sqrt(l))
    else if ((v * l) <= 0.0d0) then
        tmp = c0 / sqrt((v * (l / a)))
    else if ((v * l) <= 2d+251) 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+138) {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else if ((V * l) <= 0.0) {
		tmp = c0 / Math.sqrt((V * (l / A)));
	} else if ((V * l) <= 2e+251) {
		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+138:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	elif (V * l) <= 0.0:
		tmp = c0 / math.sqrt((V * (l / A)))
	elif (V * l) <= 2e+251:
		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+138)
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	elseif (Float64(V * l) <= 0.0)
		tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A))));
	elseif (Float64(V * l) <= 2e+251)
		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+138)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	elseif ((V * l) <= 0.0)
		tmp = c0 / sqrt((V * (l / A)));
	elseif ((V * l) <= 2e+251)
		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+138], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+251], 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^{+138}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

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

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+251}:\\
\;\;\;\;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.0000000000000001e138

    1. Initial program 58.7%

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

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

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

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

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

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

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

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

    if -2.0000000000000001e138 < (*.f64 V l) < 0.0

    1. Initial program 70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 V l) < 2.0000000000000001e251

    1. Initial program 84.3%

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

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

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

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

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

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

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

    if 2.0000000000000001e251 < (*.f64 V l)

    1. Initial program 40.7%

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\ell \cdot \frac{V}{A}}}} \]
    5. Taylor expanded in l around 0 40.7%

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

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

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

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

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+251}:\\
\;\;\;\;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 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*71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 V l) < 2.0000000000000001e251

    1. Initial program 84.3%

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

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

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

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

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

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

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

    if 2.0000000000000001e251 < (*.f64 V l)

    1. Initial program 40.7%

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{\ell \cdot \frac{V}{A}}}} \]
    5. Taylor expanded in l around 0 40.7%

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

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

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

Alternative 7: 78.7% accurate, 0.9× speedup?

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t\_0}\\


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

    1. Initial program 35.6%

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

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

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

    if 0.0 < (/.f64 A (*.f64 V l)) < 4.99999999999999994e254

    1. Initial program 99.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{A}{V \cdot \ell} \leq 0 \lor \neg \left(\frac{A}{V \cdot \ell} \leq 5 \cdot 10^{+254}\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 8: 78.2% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 32.6%

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

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

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

    if 1.00000000000000002e-251 < (/.f64 A (*.f64 V l)) < 5.00000000000000023e247

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000023e247 < (/.f64 A (*.f64 V l))

    1. Initial program 45.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 73.0% 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 72.5%

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

Reproduce

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