Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.3% → 91.6%
Time: 14.1s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 74.3% 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.6% accurate, 0.5× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -inf.0 or -9.9999999999999996e-303 < (*.f64 V l) < -0.0

    1. Initial program 47.9%

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

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

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

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

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

        \[\leadsto c0 \cdot {\left({\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \]
    4. Applied egg-rr47.9%

      \[\leadsto c0 \cdot \color{blue}{{\left({\left(\frac{A}{V \cdot \ell}\right)}^{0.25}\right)}^{2}} \]
    5. Taylor expanded in c0 around 0 47.9%

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -9.9999999999999996e-303

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999998e284

    1. Initial program 87.7%

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

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

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

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

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

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

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

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

    if 9.9999999999999998e284 < (*.f64 V l)

    1. Initial program 44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-302}:\\ \;\;\;\;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 10^{+285}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 89.9% accurate, 0.3× speedup?

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

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


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

    1. Initial program 78.1%

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

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

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

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

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

        \[\leadsto c0 \cdot {\left({\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \]
    4. Applied egg-rr77.8%

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

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

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

        \[\leadsto {\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{0.5}} \cdot c0 \]
      4. pow1/278.1%

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < A

    1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

Alternative 3: 90.0% accurate, 0.3× speedup?

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

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


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

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < A

    1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

Alternative 4: 88.3% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 59.2%

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

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

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

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

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

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

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

    if -2e176 < (*.f64 V l) < -2e-160

    1. Initial program 95.6%

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

    if -0.0 < (*.f64 V l) < 9.9999999999999998e284

    1. Initial program 87.7%

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

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

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

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

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

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

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

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

    if 9.9999999999999998e284 < (*.f64 V l)

    1. Initial program 44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 87.9% accurate, 0.5× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -2e176 or -2.00000000000000003e-155 < (*.f64 V l) < -0.0

    1. Initial program 60.2%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left({\left(\frac{A}{V \cdot \ell}\right)}^{0.25}\right)}^{2} \cdot c0} \]
      2. pow-pow60.2%

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

        \[\leadsto {\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{0.5}} \cdot c0 \]
      4. pow1/260.2%

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

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

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

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

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

    if -2e176 < (*.f64 V l) < -2.00000000000000003e-155

    1. Initial program 95.5%

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

    if -0.0 < (*.f64 V l) < 9.9999999999999998e284

    1. Initial program 87.7%

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

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

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

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

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

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

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

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

    if 9.9999999999999998e284 < (*.f64 V l)

    1. Initial program 44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 53.4%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\left({\left(\frac{A}{V}\right)}^{0.5} \cdot {\left(\frac{1}{\ell}\right)}^{0.5}\right)} \]
      5. pow1/233.8%

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

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

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

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

    if -2e176 < (*.f64 V l) < -2.00000000000000003e-155

    1. Initial program 95.5%

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

    if -2.00000000000000003e-155 < (*.f64 V l) < -0.0

    1. Initial program 65.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\frac{A}{V \cdot \ell}\right)}^{\left(0.25 \cdot 2\right)}} \cdot c0 \]
      3. metadata-eval65.5%

        \[\leadsto {\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{0.5}} \cdot c0 \]
      4. pow1/265.5%

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999998e284

    1. Initial program 87.7%

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

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

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

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

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

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

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

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

    if 9.9999999999999998e284 < (*.f64 V l)

    1. Initial program 44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 56.8%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\left({\left(\frac{A}{V}\right)}^{0.5} \cdot {\left(\frac{1}{\ell}\right)}^{0.5}\right)} \]
      5. pow1/239.4%

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

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

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

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

    if -4.9999999999999998e210 < (*.f64 V l) < -1.99999999999999997e-265

    1. Initial program 87.6%

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

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

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

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

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

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

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

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

    if -1.99999999999999997e-265 < (*.f64 V l) < -0.0

    1. Initial program 54.2%

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999998e284

    1. Initial program 87.7%

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

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

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

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

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

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

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

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

    if 9.9999999999999998e284 < (*.f64 V l)

    1. Initial program 44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 56.8%

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

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

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

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

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

        \[\leadsto c0 \cdot {\left({\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \]
    4. Applied egg-rr56.8%

      \[\leadsto c0 \cdot \color{blue}{{\left({\left(\frac{A}{V \cdot \ell}\right)}^{0.25}\right)}^{2}} \]
    5. Taylor expanded in c0 around 0 56.8%

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

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

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

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

    if -4.9999999999999998e210 < (*.f64 V l) < -0.0

    1. Initial program 79.4%

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

    if -0.0 < (*.f64 V l) < 9.9999999999999998e284

    1. Initial program 87.7%

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

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

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

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

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

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

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

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

    if 9.9999999999999998e284 < (*.f64 V l)

    1. Initial program 44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 77.2% accurate, 0.9× speedup?

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

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


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

    1. Initial program 41.6%

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

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

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

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

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

        \[\leadsto c0 \cdot {\left({\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \]
    4. Applied egg-rr41.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 88.2%

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

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

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

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

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

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

Alternative 10: 77.5% accurate, 0.9× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 10^{-309}:\\ \;\;\;\;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 (<= t_0 1e-309) (* 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 <= 1e-309) {
		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 <= 1d-309) 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 <= 1e-309) {
		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 <= 1e-309:
		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 <= 1e-309)
		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 <= 1e-309)
		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[LessEqual[t$95$0, 1e-309], 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 10^{-309}:\\
\;\;\;\;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)) < 1.000000000000002e-309

    1. Initial program 43.3%

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

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

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

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

    if 1.000000000000002e-309 < (/.f64 A (*.f64 V l))

    1. Initial program 88.6%

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

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

Alternative 11: 77.5% accurate, 0.9× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \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 (<= t_0 0.0) (/ c0 (sqrt (* l (/ V A)))) (* 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) {
		tmp = c0 / sqrt((l * (V / A)));
	} 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) then
        tmp = c0 / sqrt((l * (v / a)))
    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) {
		tmp = c0 / Math.sqrt((l * (V / A)));
	} 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:
		tmp = c0 / math.sqrt((l * (V / A)))
	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)
		tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A))));
	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)
		tmp = c0 / sqrt((l * (V / A)));
	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[LessEqual[t$95$0, 0.0], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $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:\\
\;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\

\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

    1. Initial program 41.6%

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

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

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

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

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

        \[\leadsto c0 \cdot {\left({\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \]
    4. Applied egg-rr41.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 88.2%

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

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

Alternative 12: 74.3% 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 78.3%

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

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

Reproduce

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