Henrywood and Agarwal, Equation (3)

Percentage Accurate: 72.6% → 89.3%
Time: 11.5s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 72.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < A

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

Alternative 2: 86.4% accurate, 0.3× speedup?

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

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


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

    1. Initial program 79.2%

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < V

    1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 85.7% accurate, 0.3× speedup?

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

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


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

    1. Initial program 79.2%

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < V

    1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 36.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{c0}{\sqrt{\ell}}}{\frac{1}{\sqrt{\frac{A}{V}}}}} \]
      11. pow1/242.7%

        \[\leadsto \frac{\frac{c0}{\sqrt{\ell}}}{\frac{1}{\color{blue}{{\left(\frac{A}{V}\right)}^{0.5}}}} \]
      12. pow-flip42.7%

        \[\leadsto \frac{\frac{c0}{\sqrt{\ell}}}{\color{blue}{{\left(\frac{A}{V}\right)}^{\left(-0.5\right)}}} \]
      13. metadata-eval42.7%

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

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

    if -inf.0 < (*.f64 V l) < -1.00000000000000003e-300

    1. Initial program 91.3%

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

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

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

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

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

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

    if -1.00000000000000003e-300 < (*.f64 V l) < -0.0

    1. Initial program 36.6%

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 84.7% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 44.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{c0}{\sqrt{\ell}}}{\frac{1}{\sqrt{\frac{A}{V}}}}} \]
      11. pow1/250.2%

        \[\leadsto \frac{\frac{c0}{\sqrt{\ell}}}{\frac{1}{\color{blue}{{\left(\frac{A}{V}\right)}^{0.5}}}} \]
      12. pow-flip50.3%

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

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

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

    if -4e220 < (*.f64 V l) < -1.99999999999999987e-275

    1. Initial program 94.9%

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

    if -1.99999999999999987e-275 < (*.f64 V l) < -0.0

    1. Initial program 39.6%

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 84.7% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 44.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{c0}{\sqrt{\ell}}}{\frac{1}{\sqrt{\frac{A}{V}}}}} \]
      11. pow1/250.2%

        \[\leadsto \frac{\frac{c0}{\sqrt{\ell}}}{\frac{1}{\color{blue}{{\left(\frac{A}{V}\right)}^{0.5}}}} \]
      12. pow-flip50.3%

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

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

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

    if -4e220 < (*.f64 V l) < -1.99999999999999987e-275

    1. Initial program 94.9%

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

    if -1.99999999999999987e-275 < (*.f64 V l) < -0.0

    1. Initial program 39.6%

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 80.2%

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

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

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

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

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

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

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

Alternative 7: 84.7% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 41.3%

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

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

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

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

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

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

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

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

    if -4e220 < (*.f64 V l) < -1.99999999999999987e-275

    1. Initial program 94.9%

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

    if -0.0 < (*.f64 V l)

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 54.6%

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

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

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

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

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

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

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

    if -4.0000000000000001e138 < (*.f64 V l) < -5.00000000000000043e-212

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 80.2%

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

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

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

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

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

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

Alternative 9: 81.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 81.5%

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

    if -1.00000000000000004e-166 < (*.f64 V l) < 1.999999999999994e-310

    1. Initial program 57.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.999999999999994e-310 < (*.f64 V l)

    1. Initial program 80.0%

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

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

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

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

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

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

Alternative 10: 79.0% accurate, 0.9× speedup?

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

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


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

    1. Initial program 43.1%

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

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

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

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

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

    1. Initial program 99.0%

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

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

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

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+272}:\\
\;\;\;\;c0 \cdot \sqrt{t\_0}\\

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


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

    1. Initial program 40.1%

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

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

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

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

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

    1. Initial program 99.0%

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

    if 2.0000000000000001e272 < (/.f64 A (*.f64 V l))

    1. Initial program 44.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 79.7% accurate, 0.9× speedup?

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

\mathbf{elif}\;t\_0 \leq 10^{+297}:\\
\;\;\;\;c0 \cdot \sqrt{t\_0}\\

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


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

    1. Initial program 40.1%

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

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

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

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

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

    1. Initial program 99.0%

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

    if 1e297 < (/.f64 A (*.f64 V l))

    1. Initial program 42.8%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      10. div-inv58.4%

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

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

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

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

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

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

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

Alternative 13: 72.6% 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 76.1%

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

Reproduce

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