Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.2% → 90.6%
Time: 11.2s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 73.2% accurate, 1.0× speedup?

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

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

Alternative 1: 90.6% accurate, 0.3× speedup?

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

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


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

    1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < A

    1. Initial program 68.5%

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

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

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

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

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

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

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

Alternative 2: 76.5% accurate, 0.3× speedup?

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

\mathbf{elif}\;t_0 \leq 4 \cdot 10^{+292}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-290 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.0000000000000001e292

    1. Initial program 99.4%

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

    if 4.0000000000000001e292 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 76.3% accurate, 0.3× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 2.0000000000000001e-290 or 2.00000000000000013e265 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 65.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{1} \cdot \frac{\ell}{A}}}} \]
      10. /-rgt-identity67.4%

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

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

    if 2.0000000000000001e-290 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 2.00000000000000013e265

    1. Initial program 99.4%

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

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

Alternative 4: 76.3% accurate, 0.3× speedup?

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

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+265}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-290 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 2.00000000000000013e265

    1. Initial program 99.4%

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

    if 2.00000000000000013e265 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 51.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 90.7% accurate, 0.3× speedup?

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

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


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

    1. Initial program 78.6%

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < A

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 59.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999981e215 < (*.f64 V l) < -3.9999999999999999e-132

    1. Initial program 95.1%

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

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

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

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

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

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

    if 0.0 < (*.f64 V l)

    1. Initial program 71.4%

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

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

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

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

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

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

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

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

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

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

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

\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) < -1.99999999999999981e215 or -3.9999999999999999e-132 < (*.f64 V l) < 0.0

    1. Initial program 59.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999981e215 < (*.f64 V l) < -3.9999999999999999e-132

    1. Initial program 95.1%

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

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

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

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

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

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

    if 0.0 < (*.f64 V l)

    1. Initial program 71.4%

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

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

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

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

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

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

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

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

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

Alternative 8: 85.3% accurate, 0.5× speedup?

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

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

\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) < -1.99999999999999993e278 or -4.00000000000000022e-128 < (*.f64 V l) < 0.0

    1. Initial program 57.2%

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

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

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

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

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

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

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

    if -1.99999999999999993e278 < (*.f64 V l) < -4.00000000000000022e-128

    1. Initial program 96.5%

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

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

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

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

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

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

    if 0.0 < (*.f64 V l)

    1. Initial program 71.4%

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

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

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

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

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

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

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

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

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

Alternative 9: 85.3% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 57.2%

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

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

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

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

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

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

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

    if -1.99999999999999993e278 < (*.f64 V l) < -4.00000000000000022e-128

    1. Initial program 96.5%

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

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

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

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

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

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

    if 0.0 < (*.f64 V l)

    1. Initial program 71.4%

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

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

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

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

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

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

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

Alternative 10: 88.6% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 28.9%

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -9.9999999999999999e-132

    1. Initial program 93.2%

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

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

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

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

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

    if -9.9999999999999999e-132 < (*.f64 V l) < 0.0

    1. Initial program 64.2%

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

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

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

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

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

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

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

    if 0.0 < (*.f64 V l)

    1. Initial program 71.4%

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

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

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

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

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

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

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

Alternative 11: 74.8% accurate, 0.5× speedup?

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

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


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

    1. Initial program 68.3%

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

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

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

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

    1. Initial program 82.4%

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

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

Alternative 12: 80.3% accurate, 0.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 1.1800000000000001e-279

    1. Initial program 75.9%

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

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

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

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

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

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

    if 1.1800000000000001e-279 < l

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.18 \cdot 10^{-279}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \left(\frac{1}{V} \cdot \frac{1}{\ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 13: 73.2% accurate, 1.0× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \end{array} \]
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	return c0 * sqrt((A / (V * l)));
}
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    code = c0 * sqrt((a / (v * l)))
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	return c0 * Math.sqrt((A / (V * l)));
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	return Float64(c0 * sqrt(Float64(A / Float64(V * l))))
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp = code(c0, A, V, l)
	tmp = c0 * sqrt((A / (V * l)));
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Derivation
  1. Initial program 73.7%

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

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

Reproduce

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