Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.2% → 89.7%
Time: 11.2s
Alternatives: 10
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 74.2% accurate, 1.0× speedup?

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

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

Alternative 1: 89.7% accurate, 0.5× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+167}:\\ \;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0\_m}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -4 \cdot 10^{-306}:\\ \;\;\;\;c0\_m \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \left(c0\_m \cdot \frac{c0\_m}{\ell}\right)}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+206}:\\ \;\;\;\;c0\_m \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (*
  c0_s
  (if (<= (* V l) -2e+167)
    (* (sqrt (/ A V)) (/ c0_m (sqrt l)))
    (if (<= (* V l) -4e-306)
      (* c0_m (/ (sqrt (- A)) (sqrt (* V (- l)))))
      (if (<= (* V l) 0.0)
        (sqrt (* (/ A V) (* c0_m (/ c0_m l))))
        (if (<= (* V l) 1e+206)
          (* c0_m (/ (sqrt A) (sqrt (* V l))))
          (* c0_m (sqrt (/ (/ A V) l)))))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -2e+167) {
		tmp = sqrt((A / V)) * (c0_m / sqrt(l));
	} else if ((V * l) <= -4e-306) {
		tmp = c0_m * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	} else if ((V * l) <= 1e+206) {
		tmp = c0_m * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0_m * sqrt(((A / V) / l));
	}
	return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if ((v * l) <= (-2d+167)) then
        tmp = sqrt((a / v)) * (c0_m / sqrt(l))
    else if ((v * l) <= (-4d-306)) then
        tmp = c0_m * (sqrt(-a) / sqrt((v * -l)))
    else if ((v * l) <= 0.0d0) then
        tmp = sqrt(((a / v) * (c0_m * (c0_m / l))))
    else if ((v * l) <= 1d+206) then
        tmp = c0_m * (sqrt(a) / sqrt((v * l)))
    else
        tmp = c0_m * sqrt(((a / v) / l))
    end if
    code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -2e+167) {
		tmp = Math.sqrt((A / V)) * (c0_m / Math.sqrt(l));
	} else if ((V * l) <= -4e-306) {
		tmp = c0_m * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = Math.sqrt(((A / V) * (c0_m * (c0_m / l))));
	} else if ((V * l) <= 1e+206) {
		tmp = c0_m * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0_m * Math.sqrt(((A / V) / l));
	}
	return c0_s * tmp;
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	tmp = 0
	if (V * l) <= -2e+167:
		tmp = math.sqrt((A / V)) * (c0_m / math.sqrt(l))
	elif (V * l) <= -4e-306:
		tmp = c0_m * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 0.0:
		tmp = math.sqrt(((A / V) * (c0_m * (c0_m / l))))
	elif (V * l) <= 1e+206:
		tmp = c0_m * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0_m * math.sqrt(((A / V) / l))
	return c0_s * tmp
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= -2e+167)
		tmp = Float64(sqrt(Float64(A / V)) * Float64(c0_m / sqrt(l)));
	elseif (Float64(V * l) <= -4e-306)
		tmp = Float64(c0_m * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 0.0)
		tmp = sqrt(Float64(Float64(A / V) * Float64(c0_m * Float64(c0_m / l))));
	elseif (Float64(V * l) <= 1e+206)
		tmp = Float64(c0_m * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0_m * sqrt(Float64(Float64(A / V) / l)));
	end
	return Float64(c0_s * tmp)
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -2e+167)
		tmp = sqrt((A / V)) * (c0_m / sqrt(l));
	elseif ((V * l) <= -4e-306)
		tmp = c0_m * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 0.0)
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	elseif ((V * l) <= 1e+206)
		tmp = c0_m * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0_m * sqrt(((A / V) / l));
	end
	tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := N[(c0$95$s * If[LessEqual[N[(V * l), $MachinePrecision], -2e+167], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0$95$m / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -4e-306], N[(c0$95$m * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[Sqrt[N[(N[(A / V), $MachinePrecision] * N[(c0$95$m * N[(c0$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+206], N[(c0$95$m * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0$95$m * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+167}:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0\_m}{\sqrt{\ell}}\\

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

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\sqrt{\frac{A}{V} \cdot \left(c0\_m \cdot \frac{c0\_m}{\ell}\right)}\\

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

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


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

    1. Initial program 54.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e167 < (*.f64 V l) < -4.00000000000000011e-306

    1. Initial program 86.2%

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

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

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

        \[\leadsto c0 \cdot \frac{\sqrt{-A}}{\sqrt{\color{blue}{V \cdot \left(-\ell\right)}}} \]
    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) < -0.0

    1. Initial program 38.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 1e206

    1. Initial program 88.4%

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

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

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

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

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

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

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

    if 1e206 < (*.f64 V l)

    1. Initial program 52.3%

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

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

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

Alternative 2: 79.8% accurate, 0.3× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ \begin{array}{l} t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 10^{-174}:\\ \;\;\;\;c0\_m \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+302}:\\ \;\;\;\;c0\_m \cdot \sqrt{A \cdot \frac{\frac{1}{V}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \left(c0\_m \cdot \frac{c0\_m}{\ell}\right)}\\ \end{array} \end{array} \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (let* ((t_0 (* c0_m (sqrt (/ A (* V l))))))
   (*
    c0_s
    (if (<= t_0 1e-174)
      (* c0_m (pow (* l (/ V A)) -0.5))
      (if (<= t_0 4e+302)
        (* c0_m (sqrt (* A (/ (/ 1.0 V) l))))
        (sqrt (* (/ A V) (* c0_m (/ c0_m l)))))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 1e-174) {
		tmp = c0_m * pow((l * (V / A)), -0.5);
	} else if (t_0 <= 4e+302) {
		tmp = c0_m * sqrt((A * ((1.0 / V) / l)));
	} else {
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	}
	return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    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_m * sqrt((a / (v * l)))
    if (t_0 <= 1d-174) then
        tmp = c0_m * ((l * (v / a)) ** (-0.5d0))
    else if (t_0 <= 4d+302) then
        tmp = c0_m * sqrt((a * ((1.0d0 / v) / l)))
    else
        tmp = sqrt(((a / v) * (c0_m * (c0_m / l))))
    end if
    code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * Math.sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 1e-174) {
		tmp = c0_m * Math.pow((l * (V / A)), -0.5);
	} else if (t_0 <= 4e+302) {
		tmp = c0_m * Math.sqrt((A * ((1.0 / V) / l)));
	} else {
		tmp = Math.sqrt(((A / V) * (c0_m * (c0_m / l))));
	}
	return c0_s * tmp;
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	t_0 = c0_m * math.sqrt((A / (V * l)))
	tmp = 0
	if t_0 <= 1e-174:
		tmp = c0_m * math.pow((l * (V / A)), -0.5)
	elif t_0 <= 4e+302:
		tmp = c0_m * math.sqrt((A * ((1.0 / V) / l)))
	else:
		tmp = math.sqrt(((A / V) * (c0_m * (c0_m / l))))
	return c0_s * tmp
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	t_0 = Float64(c0_m * sqrt(Float64(A / Float64(V * l))))
	tmp = 0.0
	if (t_0 <= 1e-174)
		tmp = Float64(c0_m * (Float64(l * Float64(V / A)) ^ -0.5));
	elseif (t_0 <= 4e+302)
		tmp = Float64(c0_m * sqrt(Float64(A * Float64(Float64(1.0 / V) / l))));
	else
		tmp = sqrt(Float64(Float64(A / V) * Float64(c0_m * Float64(c0_m / l))));
	end
	return Float64(c0_s * tmp)
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
	t_0 = c0_m * sqrt((A / (V * l)));
	tmp = 0.0;
	if (t_0 <= 1e-174)
		tmp = c0_m * ((l * (V / A)) ^ -0.5);
	elseif (t_0 <= 4e+302)
		tmp = c0_m * sqrt((A * ((1.0 / V) / l)));
	else
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	end
	tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := Block[{t$95$0 = N[(c0$95$m * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 1e-174], N[(c0$95$m * N[Power[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+302], N[(c0$95$m * N[Sqrt[N[(A * N[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(A / V), $MachinePrecision] * N[(c0$95$m * N[(c0$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 10^{-174}:\\
\;\;\;\;c0\_m \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\

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

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


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

    1. Initial program 69.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e-174 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.0000000000000003e302

    1. Initial program 99.5%

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

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

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

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

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

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

    1. Initial program 47.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V} \cdot \frac{{c0}^{2}}{\ell}}} \]
    10. Simplified65.3%

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

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

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

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

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

Alternative 3: 80.6% accurate, 0.3× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ \begin{array}{l} t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 10^{-211}:\\ \;\;\;\;c0\_m \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+302}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \left(c0\_m \cdot \frac{c0\_m}{\ell}\right)}\\ \end{array} \end{array} \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (let* ((t_0 (* c0_m (sqrt (/ A (* V l))))))
   (*
    c0_s
    (if (<= t_0 1e-211)
      (* c0_m (pow (* l (/ V A)) -0.5))
      (if (<= t_0 4e+302) t_0 (sqrt (* (/ A V) (* c0_m (/ c0_m l)))))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 1e-211) {
		tmp = c0_m * pow((l * (V / A)), -0.5);
	} else if (t_0 <= 4e+302) {
		tmp = t_0;
	} else {
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	}
	return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    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_m * sqrt((a / (v * l)))
    if (t_0 <= 1d-211) then
        tmp = c0_m * ((l * (v / a)) ** (-0.5d0))
    else if (t_0 <= 4d+302) then
        tmp = t_0
    else
        tmp = sqrt(((a / v) * (c0_m * (c0_m / l))))
    end if
    code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * Math.sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 1e-211) {
		tmp = c0_m * Math.pow((l * (V / A)), -0.5);
	} else if (t_0 <= 4e+302) {
		tmp = t_0;
	} else {
		tmp = Math.sqrt(((A / V) * (c0_m * (c0_m / l))));
	}
	return c0_s * tmp;
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	t_0 = c0_m * math.sqrt((A / (V * l)))
	tmp = 0
	if t_0 <= 1e-211:
		tmp = c0_m * math.pow((l * (V / A)), -0.5)
	elif t_0 <= 4e+302:
		tmp = t_0
	else:
		tmp = math.sqrt(((A / V) * (c0_m * (c0_m / l))))
	return c0_s * tmp
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	t_0 = Float64(c0_m * sqrt(Float64(A / Float64(V * l))))
	tmp = 0.0
	if (t_0 <= 1e-211)
		tmp = Float64(c0_m * (Float64(l * Float64(V / A)) ^ -0.5));
	elseif (t_0 <= 4e+302)
		tmp = t_0;
	else
		tmp = sqrt(Float64(Float64(A / V) * Float64(c0_m * Float64(c0_m / l))));
	end
	return Float64(c0_s * tmp)
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
	t_0 = c0_m * sqrt((A / (V * l)));
	tmp = 0.0;
	if (t_0 <= 1e-211)
		tmp = c0_m * ((l * (V / A)) ^ -0.5);
	elseif (t_0 <= 4e+302)
		tmp = t_0;
	else
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	end
	tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := Block[{t$95$0 = N[(c0$95$m * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 1e-211], N[(c0$95$m * N[Power[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+302], t$95$0, N[Sqrt[N[(N[(A / V), $MachinePrecision] * N[(c0$95$m * N[(c0$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 10^{-211}:\\
\;\;\;\;c0\_m \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+302}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000009e-211 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.0000000000000003e302

    1. Initial program 99.5%

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

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

    1. Initial program 47.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V} \cdot \frac{{c0}^{2}}{\ell}}} \]
    10. Simplified65.3%

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

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

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

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

Alternative 4: 79.5% accurate, 0.3× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ \begin{array}{l} t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{-228} \lor \neg \left(t\_0 \leq 4 \cdot 10^{+302}\right):\\ \;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (let* ((t_0 (* c0_m (sqrt (/ A (* V l))))))
   (*
    c0_s
    (if (or (<= t_0 2e-228) (not (<= t_0 4e+302)))
      (* c0_m (sqrt (/ (/ A V) l)))
      t_0))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * sqrt((A / (V * l)));
	double tmp;
	if ((t_0 <= 2e-228) || !(t_0 <= 4e+302)) {
		tmp = c0_m * sqrt(((A / V) / l));
	} else {
		tmp = t_0;
	}
	return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    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_m * sqrt((a / (v * l)))
    if ((t_0 <= 2d-228) .or. (.not. (t_0 <= 4d+302))) then
        tmp = c0_m * sqrt(((a / v) / l))
    else
        tmp = t_0
    end if
    code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * Math.sqrt((A / (V * l)));
	double tmp;
	if ((t_0 <= 2e-228) || !(t_0 <= 4e+302)) {
		tmp = c0_m * Math.sqrt(((A / V) / l));
	} else {
		tmp = t_0;
	}
	return c0_s * tmp;
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	t_0 = c0_m * math.sqrt((A / (V * l)))
	tmp = 0
	if (t_0 <= 2e-228) or not (t_0 <= 4e+302):
		tmp = c0_m * math.sqrt(((A / V) / l))
	else:
		tmp = t_0
	return c0_s * tmp
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	t_0 = Float64(c0_m * sqrt(Float64(A / Float64(V * l))))
	tmp = 0.0
	if ((t_0 <= 2e-228) || !(t_0 <= 4e+302))
		tmp = Float64(c0_m * sqrt(Float64(Float64(A / V) / l)));
	else
		tmp = t_0;
	end
	return Float64(c0_s * tmp)
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
	t_0 = c0_m * sqrt((A / (V * l)));
	tmp = 0.0;
	if ((t_0 <= 2e-228) || ~((t_0 <= 4e+302)))
		tmp = c0_m * sqrt(((A / V) / l));
	else
		tmp = t_0;
	end
	tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := Block[{t$95$0 = N[(c0$95$m * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[Or[LessEqual[t$95$0, 2e-228], N[Not[LessEqual[t$95$0, 4e+302]], $MachinePrecision]], N[(c0$95$m * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-228} \lor \neg \left(t\_0 \leq 4 \cdot 10^{+302}\right):\\
\;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 2.00000000000000007e-228 or 4.0000000000000003e302 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 64.9%

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

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

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

    if 2.00000000000000007e-228 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.0000000000000003e302

    1. Initial program 99.5%

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

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

Alternative 5: 79.4% accurate, 0.3× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ \begin{array}{l} t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 10^{-211}:\\ \;\;\;\;c0\_m \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+273}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0\_m}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \end{array} \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (let* ((t_0 (* c0_m (sqrt (/ A (* V l))))))
   (*
    c0_s
    (if (<= t_0 1e-211)
      (* c0_m (pow (* l (/ V A)) -0.5))
      (if (<= t_0 2e+273) t_0 (/ c0_m (sqrt (* V (/ l A)))))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 1e-211) {
		tmp = c0_m * pow((l * (V / A)), -0.5);
	} else if (t_0 <= 2e+273) {
		tmp = t_0;
	} else {
		tmp = c0_m / sqrt((V * (l / A)));
	}
	return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    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_m * sqrt((a / (v * l)))
    if (t_0 <= 1d-211) then
        tmp = c0_m * ((l * (v / a)) ** (-0.5d0))
    else if (t_0 <= 2d+273) then
        tmp = t_0
    else
        tmp = c0_m / sqrt((v * (l / a)))
    end if
    code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * Math.sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 1e-211) {
		tmp = c0_m * Math.pow((l * (V / A)), -0.5);
	} else if (t_0 <= 2e+273) {
		tmp = t_0;
	} else {
		tmp = c0_m / Math.sqrt((V * (l / A)));
	}
	return c0_s * tmp;
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	t_0 = c0_m * math.sqrt((A / (V * l)))
	tmp = 0
	if t_0 <= 1e-211:
		tmp = c0_m * math.pow((l * (V / A)), -0.5)
	elif t_0 <= 2e+273:
		tmp = t_0
	else:
		tmp = c0_m / math.sqrt((V * (l / A)))
	return c0_s * tmp
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	t_0 = Float64(c0_m * sqrt(Float64(A / Float64(V * l))))
	tmp = 0.0
	if (t_0 <= 1e-211)
		tmp = Float64(c0_m * (Float64(l * Float64(V / A)) ^ -0.5));
	elseif (t_0 <= 2e+273)
		tmp = t_0;
	else
		tmp = Float64(c0_m / sqrt(Float64(V * Float64(l / A))));
	end
	return Float64(c0_s * tmp)
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
	t_0 = c0_m * sqrt((A / (V * l)));
	tmp = 0.0;
	if (t_0 <= 1e-211)
		tmp = c0_m * ((l * (V / A)) ^ -0.5);
	elseif (t_0 <= 2e+273)
		tmp = t_0;
	else
		tmp = c0_m / sqrt((V * (l / A)));
	end
	tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := Block[{t$95$0 = N[(c0$95$m * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 1e-211], N[(c0$95$m * N[Power[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+273], t$95$0, N[(c0$95$m / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 10^{-211}:\\
\;\;\;\;c0\_m \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+273}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000009e-211 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.99999999999999989e273

    1. Initial program 99.5%

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

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

    1. Initial program 50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.6% accurate, 0.3× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ \begin{array}{l} t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{-228}:\\ \;\;\;\;\frac{c0\_m}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+273}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0\_m}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \end{array} \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (let* ((t_0 (* c0_m (sqrt (/ A (* V l))))))
   (*
    c0_s
    (if (<= t_0 2e-228)
      (/ c0_m (sqrt (* l (/ V A))))
      (if (<= t_0 2e+273) t_0 (/ c0_m (sqrt (* V (/ l A)))))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 2e-228) {
		tmp = c0_m / sqrt((l * (V / A)));
	} else if (t_0 <= 2e+273) {
		tmp = t_0;
	} else {
		tmp = c0_m / sqrt((V * (l / A)));
	}
	return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    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_m * sqrt((a / (v * l)))
    if (t_0 <= 2d-228) then
        tmp = c0_m / sqrt((l * (v / a)))
    else if (t_0 <= 2d+273) then
        tmp = t_0
    else
        tmp = c0_m / sqrt((v * (l / a)))
    end if
    code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * Math.sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 2e-228) {
		tmp = c0_m / Math.sqrt((l * (V / A)));
	} else if (t_0 <= 2e+273) {
		tmp = t_0;
	} else {
		tmp = c0_m / Math.sqrt((V * (l / A)));
	}
	return c0_s * tmp;
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	t_0 = c0_m * math.sqrt((A / (V * l)))
	tmp = 0
	if t_0 <= 2e-228:
		tmp = c0_m / math.sqrt((l * (V / A)))
	elif t_0 <= 2e+273:
		tmp = t_0
	else:
		tmp = c0_m / math.sqrt((V * (l / A)))
	return c0_s * tmp
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	t_0 = Float64(c0_m * sqrt(Float64(A / Float64(V * l))))
	tmp = 0.0
	if (t_0 <= 2e-228)
		tmp = Float64(c0_m / sqrt(Float64(l * Float64(V / A))));
	elseif (t_0 <= 2e+273)
		tmp = t_0;
	else
		tmp = Float64(c0_m / sqrt(Float64(V * Float64(l / A))));
	end
	return Float64(c0_s * tmp)
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
	t_0 = c0_m * sqrt((A / (V * l)));
	tmp = 0.0;
	if (t_0 <= 2e-228)
		tmp = c0_m / sqrt((l * (V / A)));
	elseif (t_0 <= 2e+273)
		tmp = t_0;
	else
		tmp = c0_m / sqrt((V * (l / A)));
	end
	tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := Block[{t$95$0 = N[(c0$95$m * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 2e-228], N[(c0$95$m / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+273], t$95$0, N[(c0$95$m / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-228}:\\
\;\;\;\;\frac{c0\_m}{\sqrt{\ell \cdot \frac{V}{A}}}\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+273}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000007e-228 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.99999999999999989e273

    1. Initial program 99.5%

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

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

    1. Initial program 50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.8% accurate, 0.3× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ \begin{array}{l} t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{-228}:\\ \;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+273}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0\_m}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \end{array} \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (let* ((t_0 (* c0_m (sqrt (/ A (* V l))))))
   (*
    c0_s
    (if (<= t_0 2e-228)
      (* c0_m (sqrt (/ (/ A V) l)))
      (if (<= t_0 2e+273) t_0 (/ c0_m (sqrt (* V (/ l A)))))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 2e-228) {
		tmp = c0_m * sqrt(((A / V) / l));
	} else if (t_0 <= 2e+273) {
		tmp = t_0;
	} else {
		tmp = c0_m / sqrt((V * (l / A)));
	}
	return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    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_m * sqrt((a / (v * l)))
    if (t_0 <= 2d-228) then
        tmp = c0_m * sqrt(((a / v) / l))
    else if (t_0 <= 2d+273) then
        tmp = t_0
    else
        tmp = c0_m / sqrt((v * (l / a)))
    end if
    code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	double t_0 = c0_m * Math.sqrt((A / (V * l)));
	double tmp;
	if (t_0 <= 2e-228) {
		tmp = c0_m * Math.sqrt(((A / V) / l));
	} else if (t_0 <= 2e+273) {
		tmp = t_0;
	} else {
		tmp = c0_m / Math.sqrt((V * (l / A)));
	}
	return c0_s * tmp;
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	t_0 = c0_m * math.sqrt((A / (V * l)))
	tmp = 0
	if t_0 <= 2e-228:
		tmp = c0_m * math.sqrt(((A / V) / l))
	elif t_0 <= 2e+273:
		tmp = t_0
	else:
		tmp = c0_m / math.sqrt((V * (l / A)))
	return c0_s * tmp
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	t_0 = Float64(c0_m * sqrt(Float64(A / Float64(V * l))))
	tmp = 0.0
	if (t_0 <= 2e-228)
		tmp = Float64(c0_m * sqrt(Float64(Float64(A / V) / l)));
	elseif (t_0 <= 2e+273)
		tmp = t_0;
	else
		tmp = Float64(c0_m / sqrt(Float64(V * Float64(l / A))));
	end
	return Float64(c0_s * tmp)
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
	t_0 = c0_m * sqrt((A / (V * l)));
	tmp = 0.0;
	if (t_0 <= 2e-228)
		tmp = c0_m * sqrt(((A / V) / l));
	elseif (t_0 <= 2e+273)
		tmp = t_0;
	else
		tmp = c0_m / sqrt((V * (l / A)));
	end
	tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := Block[{t$95$0 = N[(c0$95$m * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 2e-228], N[(c0$95$m * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+273], t$95$0, N[(c0$95$m / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-228}:\\
\;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+273}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 68.4%

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

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

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

    if 2.00000000000000007e-228 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.99999999999999989e273

    1. Initial program 99.5%

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

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

    1. Initial program 50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 86.3% accurate, 0.5× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+163}:\\ \;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0\_m}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -4 \cdot 10^{-306}:\\ \;\;\;\;\frac{c0\_m}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \left(c0\_m \cdot \frac{c0\_m}{\ell}\right)}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+206}:\\ \;\;\;\;c0\_m \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (*
  c0_s
  (if (<= (* V l) -1e+163)
    (* (sqrt (/ A V)) (/ c0_m (sqrt l)))
    (if (<= (* V l) -4e-306)
      (/ c0_m (sqrt (/ (* V l) A)))
      (if (<= (* V l) 0.0)
        (sqrt (* (/ A V) (* c0_m (/ c0_m l))))
        (if (<= (* V l) 1e+206)
          (* c0_m (/ (sqrt A) (sqrt (* V l))))
          (* c0_m (sqrt (/ (/ A V) l)))))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -1e+163) {
		tmp = sqrt((A / V)) * (c0_m / sqrt(l));
	} else if ((V * l) <= -4e-306) {
		tmp = c0_m / sqrt(((V * l) / A));
	} else if ((V * l) <= 0.0) {
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	} else if ((V * l) <= 1e+206) {
		tmp = c0_m * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0_m * sqrt(((A / V) / l));
	}
	return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if ((v * l) <= (-1d+163)) then
        tmp = sqrt((a / v)) * (c0_m / sqrt(l))
    else if ((v * l) <= (-4d-306)) then
        tmp = c0_m / sqrt(((v * l) / a))
    else if ((v * l) <= 0.0d0) then
        tmp = sqrt(((a / v) * (c0_m * (c0_m / l))))
    else if ((v * l) <= 1d+206) then
        tmp = c0_m * (sqrt(a) / sqrt((v * l)))
    else
        tmp = c0_m * sqrt(((a / v) / l))
    end if
    code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -1e+163) {
		tmp = Math.sqrt((A / V)) * (c0_m / Math.sqrt(l));
	} else if ((V * l) <= -4e-306) {
		tmp = c0_m / Math.sqrt(((V * l) / A));
	} else if ((V * l) <= 0.0) {
		tmp = Math.sqrt(((A / V) * (c0_m * (c0_m / l))));
	} else if ((V * l) <= 1e+206) {
		tmp = c0_m * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0_m * Math.sqrt(((A / V) / l));
	}
	return c0_s * tmp;
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	tmp = 0
	if (V * l) <= -1e+163:
		tmp = math.sqrt((A / V)) * (c0_m / math.sqrt(l))
	elif (V * l) <= -4e-306:
		tmp = c0_m / math.sqrt(((V * l) / A))
	elif (V * l) <= 0.0:
		tmp = math.sqrt(((A / V) * (c0_m * (c0_m / l))))
	elif (V * l) <= 1e+206:
		tmp = c0_m * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0_m * math.sqrt(((A / V) / l))
	return c0_s * tmp
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= -1e+163)
		tmp = Float64(sqrt(Float64(A / V)) * Float64(c0_m / sqrt(l)));
	elseif (Float64(V * l) <= -4e-306)
		tmp = Float64(c0_m / sqrt(Float64(Float64(V * l) / A)));
	elseif (Float64(V * l) <= 0.0)
		tmp = sqrt(Float64(Float64(A / V) * Float64(c0_m * Float64(c0_m / l))));
	elseif (Float64(V * l) <= 1e+206)
		tmp = Float64(c0_m * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0_m * sqrt(Float64(Float64(A / V) / l)));
	end
	return Float64(c0_s * tmp)
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -1e+163)
		tmp = sqrt((A / V)) * (c0_m / sqrt(l));
	elseif ((V * l) <= -4e-306)
		tmp = c0_m / sqrt(((V * l) / A));
	elseif ((V * l) <= 0.0)
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	elseif ((V * l) <= 1e+206)
		tmp = c0_m * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0_m * sqrt(((A / V) / l));
	end
	tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := N[(c0$95$s * If[LessEqual[N[(V * l), $MachinePrecision], -1e+163], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0$95$m / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -4e-306], N[(c0$95$m / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[Sqrt[N[(N[(A / V), $MachinePrecision] * N[(c0$95$m * N[(c0$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+206], N[(c0$95$m * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0$95$m * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+163}:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0\_m}{\sqrt{\ell}}\\

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

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\sqrt{\frac{A}{V} \cdot \left(c0\_m \cdot \frac{c0\_m}{\ell}\right)}\\

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

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


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

    1. Initial program 53.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.9999999999999994e162 < (*.f64 V l) < -4.00000000000000011e-306

    1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 38.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 1e206

    1. Initial program 88.4%

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

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

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

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

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

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

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

    if 1e206 < (*.f64 V l)

    1. Initial program 52.3%

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

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

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

Alternative 9: 86.5% accurate, 0.5× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+163}:\\ \;\;\;\;c0\_m \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -4 \cdot 10^{-306}:\\ \;\;\;\;\frac{c0\_m}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \left(c0\_m \cdot \frac{c0\_m}{\ell}\right)}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+206}:\\ \;\;\;\;c0\_m \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (*
  c0_s
  (if (<= (* V l) -1e+163)
    (* c0_m (/ (sqrt (/ A V)) (sqrt l)))
    (if (<= (* V l) -4e-306)
      (/ c0_m (sqrt (/ (* V l) A)))
      (if (<= (* V l) 0.0)
        (sqrt (* (/ A V) (* c0_m (/ c0_m l))))
        (if (<= (* V l) 1e+206)
          (* c0_m (/ (sqrt A) (sqrt (* V l))))
          (* c0_m (sqrt (/ (/ A V) l)))))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -1e+163) {
		tmp = c0_m * (sqrt((A / V)) / sqrt(l));
	} else if ((V * l) <= -4e-306) {
		tmp = c0_m / sqrt(((V * l) / A));
	} else if ((V * l) <= 0.0) {
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	} else if ((V * l) <= 1e+206) {
		tmp = c0_m * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0_m * sqrt(((A / V) / l));
	}
	return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if ((v * l) <= (-1d+163)) then
        tmp = c0_m * (sqrt((a / v)) / sqrt(l))
    else if ((v * l) <= (-4d-306)) then
        tmp = c0_m / sqrt(((v * l) / a))
    else if ((v * l) <= 0.0d0) then
        tmp = sqrt(((a / v) * (c0_m * (c0_m / l))))
    else if ((v * l) <= 1d+206) then
        tmp = c0_m * (sqrt(a) / sqrt((v * l)))
    else
        tmp = c0_m * sqrt(((a / v) / l))
    end if
    code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -1e+163) {
		tmp = c0_m * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else if ((V * l) <= -4e-306) {
		tmp = c0_m / Math.sqrt(((V * l) / A));
	} else if ((V * l) <= 0.0) {
		tmp = Math.sqrt(((A / V) * (c0_m * (c0_m / l))));
	} else if ((V * l) <= 1e+206) {
		tmp = c0_m * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0_m * Math.sqrt(((A / V) / l));
	}
	return c0_s * tmp;
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	tmp = 0
	if (V * l) <= -1e+163:
		tmp = c0_m * (math.sqrt((A / V)) / math.sqrt(l))
	elif (V * l) <= -4e-306:
		tmp = c0_m / math.sqrt(((V * l) / A))
	elif (V * l) <= 0.0:
		tmp = math.sqrt(((A / V) * (c0_m * (c0_m / l))))
	elif (V * l) <= 1e+206:
		tmp = c0_m * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0_m * math.sqrt(((A / V) / l))
	return c0_s * tmp
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= -1e+163)
		tmp = Float64(c0_m * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	elseif (Float64(V * l) <= -4e-306)
		tmp = Float64(c0_m / sqrt(Float64(Float64(V * l) / A)));
	elseif (Float64(V * l) <= 0.0)
		tmp = sqrt(Float64(Float64(A / V) * Float64(c0_m * Float64(c0_m / l))));
	elseif (Float64(V * l) <= 1e+206)
		tmp = Float64(c0_m * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0_m * sqrt(Float64(Float64(A / V) / l)));
	end
	return Float64(c0_s * tmp)
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -1e+163)
		tmp = c0_m * (sqrt((A / V)) / sqrt(l));
	elseif ((V * l) <= -4e-306)
		tmp = c0_m / sqrt(((V * l) / A));
	elseif ((V * l) <= 0.0)
		tmp = sqrt(((A / V) * (c0_m * (c0_m / l))));
	elseif ((V * l) <= 1e+206)
		tmp = c0_m * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0_m * sqrt(((A / V) / l));
	end
	tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := N[(c0$95$s * If[LessEqual[N[(V * l), $MachinePrecision], -1e+163], N[(c0$95$m * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -4e-306], N[(c0$95$m / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[Sqrt[N[(N[(A / V), $MachinePrecision] * N[(c0$95$m * N[(c0$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+206], N[(c0$95$m * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0$95$m * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+163}:\\
\;\;\;\;c0\_m \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

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

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\sqrt{\frac{A}{V} \cdot \left(c0\_m \cdot \frac{c0\_m}{\ell}\right)}\\

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

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


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

    1. Initial program 53.4%

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{\frac{A}{V}} \cdot \frac{1}{\sqrt{\ell}}\right)} \]
    4. Applied egg-rr28.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/28.2%

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

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

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

    if -9.9999999999999994e162 < (*.f64 V l) < -4.00000000000000011e-306

    1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 38.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 1e206

    1. Initial program 88.4%

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

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

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

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

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

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

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

    if 1e206 < (*.f64 V l)

    1. Initial program 52.3%

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

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

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

Alternative 10: 74.2% accurate, 1.0× speedup?

\[\begin{array}{l} c0\_m = \left|c0\right| \\ c0\_s = \mathsf{copysign}\left(1, c0\right) \\ [c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\ \\ c0\_s \cdot \left(c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\right) \end{array} \]
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
 :precision binary64
 (* c0_s (* c0_m (sqrt (/ A (* V l))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
	return c0_s * (c0_m * sqrt((A / (V * l))));
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
    real(8), intent (in) :: c0_s
    real(8), intent (in) :: c0_m
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    code = c0_s * (c0_m * sqrt((a / (v * l))))
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
	return c0_s * (c0_m * Math.sqrt((A / (V * l))));
}
c0\_m = math.fabs(c0)
c0\_s = math.copysign(1.0, c0)
[c0_m, A, V, l] = sort([c0_m, A, V, l])
def code(c0_s, c0_m, A, V, l):
	return c0_s * (c0_m * math.sqrt((A / (V * l))))
c0\_m = abs(c0)
c0\_s = copysign(1.0, c0)
c0_m, A, V, l = sort([c0_m, A, V, l])
function code(c0_s, c0_m, A, V, l)
	return Float64(c0_s * Float64(c0_m * sqrt(Float64(A / Float64(V * l)))))
end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp = code(c0_s, c0_m, A, V, l)
	tmp = c0_s * (c0_m * sqrt((A / (V * l))));
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := N[(c0$95$s * N[(c0$95$m * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
c0\_s \cdot \left(c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\right)
\end{array}
Derivation
  1. Initial program 73.3%

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

Reproduce

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