Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.8% → 89.4%
Time: 12.9s
Alternatives: 10
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 10 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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 89.4% accurate, 0.5× speedup?

\[\begin{array}{l} [V, l] = \mathsf{sort}([V, l])\\ \\ \begin{array}{l} t_0 := \frac{c0}{\frac{\sqrt{-V}}{\sqrt{\frac{-A}{\ell}}}}\\ \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+248}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-282}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+296}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \end{array} \]
NOTE: 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 (- V)) (sqrt (/ (- A) l))))))
   (if (<= (* V l) -5e+248)
     t_0
     (if (<= (* V l) -2e-282)
       (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
       (if (<= (* V l) 0.0)
         t_0
         (if (<= (* V l) 2e+296)
           (/ (* c0 (sqrt A)) (sqrt (* V l)))
           (/ c0 (sqrt (* V (/ l A))))))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = c0 / (sqrt(-V) / sqrt((-A / l)));
	double tmp;
	if ((V * l) <= -5e+248) {
		tmp = t_0;
	} else if ((V * l) <= -2e-282) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else if ((V * l) <= 2e+296) {
		tmp = (c0 * sqrt(A)) / sqrt((V * l));
	} else {
		tmp = c0 / sqrt((V * (l / A)));
	}
	return tmp;
}
NOTE: 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(-v) / sqrt((-a / l)))
    if ((v * l) <= (-5d+248)) then
        tmp = t_0
    else if ((v * l) <= (-2d-282)) then
        tmp = c0 * (sqrt(-a) / sqrt((v * -l)))
    else if ((v * l) <= 0.0d0) then
        tmp = t_0
    else if ((v * l) <= 2d+296) then
        tmp = (c0 * sqrt(a)) / sqrt((v * l))
    else
        tmp = c0 / sqrt((v * (l / a)))
    end if
    code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = c0 / (Math.sqrt(-V) / Math.sqrt((-A / l)));
	double tmp;
	if ((V * l) <= -5e+248) {
		tmp = t_0;
	} else if ((V * l) <= -2e-282) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else if ((V * l) <= 2e+296) {
		tmp = (c0 * Math.sqrt(A)) / Math.sqrt((V * l));
	} else {
		tmp = c0 / Math.sqrt((V * (l / A)));
	}
	return tmp;
}
[V, l] = sort([V, l])
def code(c0, A, V, l):
	t_0 = c0 / (math.sqrt(-V) / math.sqrt((-A / l)))
	tmp = 0
	if (V * l) <= -5e+248:
		tmp = t_0
	elif (V * l) <= -2e-282:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 0.0:
		tmp = t_0
	elif (V * l) <= 2e+296:
		tmp = (c0 * math.sqrt(A)) / math.sqrt((V * l))
	else:
		tmp = c0 / math.sqrt((V * (l / A)))
	return tmp
V, l = sort([V, l])
function code(c0, A, V, l)
	t_0 = Float64(c0 / Float64(sqrt(Float64(-V)) / sqrt(Float64(Float64(-A) / l))))
	tmp = 0.0
	if (Float64(V * l) <= -5e+248)
		tmp = t_0;
	elseif (Float64(V * l) <= -2e-282)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 0.0)
		tmp = t_0;
	elseif (Float64(V * l) <= 2e+296)
		tmp = Float64(Float64(c0 * sqrt(A)) / sqrt(Float64(V * l)));
	else
		tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A))));
	end
	return tmp
end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
	t_0 = c0 / (sqrt(-V) / sqrt((-A / l)));
	tmp = 0.0;
	if ((V * l) <= -5e+248)
		tmp = t_0;
	elseif ((V * l) <= -2e-282)
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 0.0)
		tmp = t_0;
	elseif ((V * l) <= 2e+296)
		tmp = (c0 * sqrt(A)) / sqrt((V * l));
	else
		tmp = c0 / sqrt((V * (l / A)));
	end
	tmp_2 = tmp;
end
NOTE: 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[(-V)], $MachinePrecision] / N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -5e+248], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -2e-282], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 2e+296], N[(N[(c0 * N[Sqrt[A], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0}{\frac{\sqrt{-V}}{\sqrt{\frac{-A}{\ell}}}}\\
\mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+248}:\\
\;\;\;\;t_0\\

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

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

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

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


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

    1. Initial program 53.6%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*74.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{\color{blue}{\frac{\sqrt{-V}}{\sqrt{-\frac{A}{\ell}}}}} \]
    8. Step-by-step derivation
      1. distribute-neg-frac46.8%

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

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

    if -4.9999999999999996e248 < (*.f64 V l) < -2e-282

    1. Initial program 88.4%

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 1.99999999999999996e296

    1. Initial program 80.4%

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

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

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

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

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

    if 1.99999999999999996e296 < (*.f64 V l)

    1. Initial program 47.0%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*83.8%

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. div-inv83.7%

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

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

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

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

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

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

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

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

Alternative 2: 85.3% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 61.8%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*73.6%

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. div-inv73.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999974e123 < (*.f64 V l) < -1.00000000000000003e-146

    1. Initial program 93.5%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*80.7%

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. associate-/l*95.3%

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

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

    if -1.00000000000000003e-146 < (*.f64 V l) < 2.0000000000019e-312

    1. Initial program 61.2%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*76.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000019e-312 < (*.f64 V l) < 1.99999999999999996e296

    1. Initial program 80.3%

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

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

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

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

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

    if 1.99999999999999996e296 < (*.f64 V l)

    1. Initial program 47.0%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*83.8%

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. div-inv83.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+123}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-146}:\\ \;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-312}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+296}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]

Alternative 3: 85.3% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 61.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999974e123 < (*.f64 V l) < -1.00000000000000003e-146

    1. Initial program 93.5%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*80.7%

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. associate-/l*95.3%

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

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

    if -1.00000000000000003e-146 < (*.f64 V l) < 2.0000000000019e-312

    1. Initial program 61.2%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*76.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000019e-312 < (*.f64 V l) < 1.99999999999999996e296

    1. Initial program 80.3%

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

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

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

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

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

    if 1.99999999999999996e296 < (*.f64 V l)

    1. Initial program 47.0%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*83.8%

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. div-inv83.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+123}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-146}:\\ \;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-312}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+296}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]

Alternative 4: 89.6% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 48.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000013e294 < (*.f64 V l) < -2e-282

    1. Initial program 87.0%

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

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

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

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

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

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

    if -2e-282 < (*.f64 V l) < 2.0000000000019e-312

    1. Initial program 56.1%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*77.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000019e-312 < (*.f64 V l) < 1.99999999999999996e296

    1. Initial program 80.3%

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

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

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

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

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

    if 1.99999999999999996e296 < (*.f64 V l)

    1. Initial program 47.0%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*83.8%

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. div-inv83.7%

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

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

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

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

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

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

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

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

Alternative 5: 80.3% accurate, 0.5× speedup?

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

\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 < 5.9999999999999999e-252

    1. Initial program 77.8%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*78.8%

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. div-inv77.8%

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

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

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

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

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

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

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

    if 5.9999999999999999e-252 < l

    1. Initial program 69.7%

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

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

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

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

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

Alternative 6: 80.4% accurate, 0.5× speedup?

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

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


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

    1. Initial program 77.8%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*78.8%

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. div-inv77.8%

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

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

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

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

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

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

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

    if 4.3999999999999998e-252 < l

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.0% accurate, 0.9× speedup?

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

\mathbf{elif}\;t_0 \leq 4 \cdot 10^{+206}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\

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


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

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 98.2%

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

    if 4.0000000000000002e206 < (/.f64 A (*.f64 V l))

    1. Initial program 53.5%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*63.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 79.8% accurate, 0.9× speedup?

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\


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

    1. Initial program 44.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 98.2%

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

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

Alternative 9: 78.7% accurate, 0.9× speedup?

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

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+179}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\

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


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

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 98.1%

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

    if 1.99999999999999996e179 < (/.f64 A (*.f64 V l))

    1. Initial program 57.6%

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}} \]
      5. associate-/l*66.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 73.8% accurate, 1.0× speedup?

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

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

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

Reproduce

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