Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.9% → 91.9%
Time: 15.1s
Alternatives: 14
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 14 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 91.9% accurate, 0.3× speedup?

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

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

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

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


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

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000011e-306 < (*.f64 V l) < 2.0000000019e-315

    1. Initial program 43.6%

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

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

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

    if 2.0000000019e-315 < (*.f64 V l) < 1e277

    1. Initial program 86.4%

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

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

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

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

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

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

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

    if 1e277 < (*.f64 V l)

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 77.0% accurate, 0.3× speedup?

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 60.8%

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

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

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

    if 1.00000000000000005e-286 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 2.0000000000000001e299

    1. Initial program 98.5%

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

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

Alternative 3: 77.0% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 61.1%

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

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

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

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

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

    1. Initial program 98.4%

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

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

    1. Initial program 62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 77.1% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 61.1%

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

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

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

    if 1.00000000000000005e-286 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 5.0000000000000002e255

    1. Initial program 98.4%

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

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

    1. Initial program 62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 87.4% accurate, 0.3× speedup?

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

    1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 71.3%

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

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

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

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

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

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

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

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

Alternative 6: 91.0% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 41.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \left({\ell}^{\color{blue}{-0.5}} \cdot \sqrt{\frac{A}{V}}\right) \]
      7. associate-*l*57.3%

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

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

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

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

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

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

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

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

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

    if -7.50000000000000005e264 < (*.f64 V l) < -4.00000000000000011e-306

    1. Initial program 79.3%

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

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

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

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

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

    if -4.00000000000000011e-306 < (*.f64 V l) < 2.0000000019e-315

    1. Initial program 43.6%

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

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

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

    if 2.0000000019e-315 < (*.f64 V l) < 1e277

    1. Initial program 86.4%

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

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

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

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

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

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

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

    if 1e277 < (*.f64 V l)

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 85.2% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 33.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999997e304 < (*.f64 V l) < -5.0000000000000001e-128

    1. Initial program 83.1%

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

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

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

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

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

    if -5.0000000000000001e-128 < (*.f64 V l) < 2.0000000019e-315

    1. Initial program 50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000019e-315 < (*.f64 V l) < 1e277

    1. Initial program 86.4%

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

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

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

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

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

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

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

    if 1e277 < (*.f64 V l)

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 84.8% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.70000000000000007e-163

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.70000000000000007e-163 < l < -1.999999999999994e-310

    1. Initial program 58.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 71.3%

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

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

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

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

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

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

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

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

Alternative 9: 84.9% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.40000000000000011e-162

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.40000000000000011e-162 < l < -1.999999999999994e-310

    1. Initial program 58.4%

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 71.3%

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

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

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

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

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

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

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

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

Alternative 10: 83.7% accurate, 0.5× speedup?

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

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


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

    1. Initial program 68.2%

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 71.3%

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

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

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

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

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

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

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

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

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

Alternative 11: 78.9% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 A (*.f64 V l)) < 1.97626e-323 or 1.9999999999999998e212 < (/.f64 A (*.f64 V l))

    1. Initial program 41.2%

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

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

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

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

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

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

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

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

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

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

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

    if 1.97626e-323 < (/.f64 A (*.f64 V l)) < 1.9999999999999998e212

    1. Initial program 99.1%

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

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

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

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

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

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

Alternative 12: 79.3% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 35.0%

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

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

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

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

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

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

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

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

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

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

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

    if 1.97626e-323 < (/.f64 A (*.f64 V l)) < 1.9999999999999998e212

    1. Initial program 99.1%

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

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

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

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

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

    if 1.9999999999999998e212 < (/.f64 A (*.f64 V l))

    1. Initial program 47.1%

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

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

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

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

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

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

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

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

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

Alternative 13: 79.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 35.2%

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

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

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

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

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

    1. Initial program 98.5%

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

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

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

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

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

    if 1.9999999999999998e212 < (/.f64 A (*.f64 V l))

    1. Initial program 47.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 73.9% accurate, 1.0× speedup?

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

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

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

Reproduce

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