Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.9% → 88.5%
Time: 10.3s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 73.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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


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

    1. Initial program 77.3%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 77.3%

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999967e145 < (*.f64 V l) < -3.99999999999999964e-307

    1. Initial program 88.6%

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

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

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

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

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

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

    if -3.99999999999999964e-307 < (*.f64 V l) < -0.0

    1. Initial program 26.6%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 26.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 1.99999999999999984e274

    1. Initial program 84.7%

      \[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. associate-*r/94.7%

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

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

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

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

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

    if 1.99999999999999984e274 < (*.f64 V l)

    1. Initial program 23.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      7. pow222.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 86.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])\\ \\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{\frac{\sqrt{-A}}{\sqrt{-V}}}{\frac{\sqrt{\ell}}{c0\_m}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+274}:\\ \;\;\;\;\sqrt{A} \cdot \frac{c0\_m}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \frac{c0\_m}{V}\right)}{\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) 0.0)
    (/ (/ (sqrt (- A)) (sqrt (- V))) (/ (sqrt l) c0_m))
    (if (<= (* V l) 2e+274)
      (* (sqrt A) (/ c0_m (sqrt (* V l))))
      (sqrt (/ (* A (* c0_m (/ c0_m 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) <= 0.0) {
		tmp = (sqrt(-A) / sqrt(-V)) / (sqrt(l) / c0_m);
	} else if ((V * l) <= 2e+274) {
		tmp = sqrt(A) * (c0_m / sqrt((V * l)));
	} else {
		tmp = sqrt(((A * (c0_m * (c0_m / 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) <= 0.0d0) then
        tmp = (sqrt(-a) / sqrt(-v)) / (sqrt(l) / c0_m)
    else if ((v * l) <= 2d+274) then
        tmp = sqrt(a) * (c0_m / sqrt((v * l)))
    else
        tmp = sqrt(((a * (c0_m * (c0_m / 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) <= 0.0) {
		tmp = (Math.sqrt(-A) / Math.sqrt(-V)) / (Math.sqrt(l) / c0_m);
	} else if ((V * l) <= 2e+274) {
		tmp = Math.sqrt(A) * (c0_m / Math.sqrt((V * l)));
	} else {
		tmp = Math.sqrt(((A * (c0_m * (c0_m / 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) <= 0.0:
		tmp = (math.sqrt(-A) / math.sqrt(-V)) / (math.sqrt(l) / c0_m)
	elif (V * l) <= 2e+274:
		tmp = math.sqrt(A) * (c0_m / math.sqrt((V * l)))
	else:
		tmp = math.sqrt(((A * (c0_m * (c0_m / 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) <= 0.0)
		tmp = Float64(Float64(sqrt(Float64(-A)) / sqrt(Float64(-V))) / Float64(sqrt(l) / c0_m));
	elseif (Float64(V * l) <= 2e+274)
		tmp = Float64(sqrt(A) * Float64(c0_m / sqrt(Float64(V * l))));
	else
		tmp = sqrt(Float64(Float64(A * Float64(c0_m * Float64(c0_m / 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) <= 0.0)
		tmp = (sqrt(-A) / sqrt(-V)) / (sqrt(l) / c0_m);
	elseif ((V * l) <= 2e+274)
		tmp = sqrt(A) * (c0_m / sqrt((V * l)));
	else
		tmp = sqrt(((A * (c0_m * (c0_m / 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], 0.0], N[(N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / c0$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+274], N[(N[Sqrt[A], $MachinePrecision] * N[(c0$95$m / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(A * N[(c0$95$m * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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 0:\\
\;\;\;\;\frac{\frac{\sqrt{-A}}{\sqrt{-V}}}{\frac{\sqrt{\ell}}{c0\_m}}\\

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

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


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

    1. Initial program 72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 1.99999999999999984e274

    1. Initial program 84.7%

      \[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. associate-*r/94.7%

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

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

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

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

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

    if 1.99999999999999984e274 < (*.f64 V l)

    1. Initial program 23.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      7. pow222.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 86.7% 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])\\ \\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{\sqrt{-A}}{\sqrt{-V}} \cdot \frac{c0\_m}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+274}:\\ \;\;\;\;\sqrt{A} \cdot \frac{c0\_m}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \frac{c0\_m}{V}\right)}{\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) 0.0)
    (* (/ (sqrt (- A)) (sqrt (- V))) (/ c0_m (sqrt l)))
    (if (<= (* V l) 2e+274)
      (* (sqrt A) (/ c0_m (sqrt (* V l))))
      (sqrt (/ (* A (* c0_m (/ c0_m 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) <= 0.0) {
		tmp = (sqrt(-A) / sqrt(-V)) * (c0_m / sqrt(l));
	} else if ((V * l) <= 2e+274) {
		tmp = sqrt(A) * (c0_m / sqrt((V * l)));
	} else {
		tmp = sqrt(((A * (c0_m * (c0_m / 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) <= 0.0d0) then
        tmp = (sqrt(-a) / sqrt(-v)) * (c0_m / sqrt(l))
    else if ((v * l) <= 2d+274) then
        tmp = sqrt(a) * (c0_m / sqrt((v * l)))
    else
        tmp = sqrt(((a * (c0_m * (c0_m / 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) <= 0.0) {
		tmp = (Math.sqrt(-A) / Math.sqrt(-V)) * (c0_m / Math.sqrt(l));
	} else if ((V * l) <= 2e+274) {
		tmp = Math.sqrt(A) * (c0_m / Math.sqrt((V * l)));
	} else {
		tmp = Math.sqrt(((A * (c0_m * (c0_m / 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) <= 0.0:
		tmp = (math.sqrt(-A) / math.sqrt(-V)) * (c0_m / math.sqrt(l))
	elif (V * l) <= 2e+274:
		tmp = math.sqrt(A) * (c0_m / math.sqrt((V * l)))
	else:
		tmp = math.sqrt(((A * (c0_m * (c0_m / 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) <= 0.0)
		tmp = Float64(Float64(sqrt(Float64(-A)) / sqrt(Float64(-V))) * Float64(c0_m / sqrt(l)));
	elseif (Float64(V * l) <= 2e+274)
		tmp = Float64(sqrt(A) * Float64(c0_m / sqrt(Float64(V * l))));
	else
		tmp = sqrt(Float64(Float64(A * Float64(c0_m * Float64(c0_m / 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) <= 0.0)
		tmp = (sqrt(-A) / sqrt(-V)) * (c0_m / sqrt(l));
	elseif ((V * l) <= 2e+274)
		tmp = sqrt(A) * (c0_m / sqrt((V * l)));
	else
		tmp = sqrt(((A * (c0_m * (c0_m / 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], 0.0], N[(N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision] * N[(c0$95$m / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+274], N[(N[Sqrt[A], $MachinePrecision] * N[(c0$95$m / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(A * N[(c0$95$m * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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 0:\\
\;\;\;\;\frac{\sqrt{-A}}{\sqrt{-V}} \cdot \frac{c0\_m}{\sqrt{\ell}}\\

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

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


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

    1. Initial program 72.2%

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 1.99999999999999984e274

    1. Initial program 84.7%

      \[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. associate-*r/94.7%

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

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

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

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

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

    if 1.99999999999999984e274 < (*.f64 V l)

    1. Initial program 23.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      7. pow222.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 87.1% 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])\\ \\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;V \leq -1 \cdot 10^{-309}:\\ \;\;\;\;c0\_m \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\ \mathbf{else}:\\ \;\;\;\;c0\_m \cdot \frac{\sqrt{A}}{\sqrt{\ell} \cdot \sqrt{V}}\\ \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 -1e-309)
    (* c0_m (/ (sqrt (/ A (- l))) (sqrt (- V))))
    (* c0_m (/ (sqrt A) (* (sqrt l) (sqrt V)))))))
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 <= -1e-309) {
		tmp = c0_m * (sqrt((A / -l)) / sqrt(-V));
	} else {
		tmp = c0_m * (sqrt(A) / (sqrt(l) * sqrt(V)));
	}
	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 <= (-1d-309)) then
        tmp = c0_m * (sqrt((a / -l)) / sqrt(-v))
    else
        tmp = c0_m * (sqrt(a) / (sqrt(l) * sqrt(v)))
    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 <= -1e-309) {
		tmp = c0_m * (Math.sqrt((A / -l)) / Math.sqrt(-V));
	} else {
		tmp = c0_m * (Math.sqrt(A) / (Math.sqrt(l) * Math.sqrt(V)));
	}
	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 <= -1e-309:
		tmp = c0_m * (math.sqrt((A / -l)) / math.sqrt(-V))
	else:
		tmp = c0_m * (math.sqrt(A) / (math.sqrt(l) * math.sqrt(V)))
	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 (V <= -1e-309)
		tmp = Float64(c0_m * Float64(sqrt(Float64(A / Float64(-l))) / sqrt(Float64(-V))));
	else
		tmp = Float64(c0_m * Float64(sqrt(A) / Float64(sqrt(l) * sqrt(V))));
	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 <= -1e-309)
		tmp = c0_m * (sqrt((A / -l)) / sqrt(-V));
	else
		tmp = c0_m * (sqrt(A) / (sqrt(l) * sqrt(V)));
	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[V, -1e-309], N[(c0$95$m * N[(N[Sqrt[N[(A / (-l)), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0$95$m * N[(N[Sqrt[A], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[V], $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 \begin{array}{l}
\mathbf{if}\;V \leq -1 \cdot 10^{-309}:\\
\;\;\;\;c0\_m \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\

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


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

    1. Initial program 73.3%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 73.3%

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

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

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < V

    1. Initial program 75.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 89.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 -2 \cdot 10^{+302}:\\ \;\;\;\;\sqrt{\frac{A}{V}} \cdot \left(c0\_m \cdot {\ell}^{-0.5}\right)\\ \mathbf{elif}\;V \cdot \ell \leq -4 \cdot 10^{-307}:\\ \;\;\;\;c0\_m \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0\_m}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+274}:\\ \;\;\;\;\sqrt{A} \cdot \frac{c0\_m}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \frac{c0\_m}{V}\right)}{\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+302)
    (* (sqrt (/ A V)) (* c0_m (pow l -0.5)))
    (if (<= (* V l) -4e-307)
      (* c0_m (/ (sqrt (- A)) (sqrt (* V (- l)))))
      (if (<= (* V l) 0.0)
        (/ c0_m (* (sqrt l) (sqrt (/ V A))))
        (if (<= (* V l) 2e+274)
          (* (sqrt A) (/ c0_m (sqrt (* V l))))
          (sqrt (/ (* A (* c0_m (/ c0_m 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+302) {
		tmp = sqrt((A / V)) * (c0_m * pow(l, -0.5));
	} else if ((V * l) <= -4e-307) {
		tmp = c0_m * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = c0_m / (sqrt(l) * sqrt((V / A)));
	} else if ((V * l) <= 2e+274) {
		tmp = sqrt(A) * (c0_m / sqrt((V * l)));
	} else {
		tmp = sqrt(((A * (c0_m * (c0_m / 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+302)) then
        tmp = sqrt((a / v)) * (c0_m * (l ** (-0.5d0)))
    else if ((v * l) <= (-4d-307)) then
        tmp = c0_m * (sqrt(-a) / sqrt((v * -l)))
    else if ((v * l) <= 0.0d0) then
        tmp = c0_m / (sqrt(l) * sqrt((v / a)))
    else if ((v * l) <= 2d+274) then
        tmp = sqrt(a) * (c0_m / sqrt((v * l)))
    else
        tmp = sqrt(((a * (c0_m * (c0_m / 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+302) {
		tmp = Math.sqrt((A / V)) * (c0_m * Math.pow(l, -0.5));
	} else if ((V * l) <= -4e-307) {
		tmp = c0_m * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = c0_m / (Math.sqrt(l) * Math.sqrt((V / A)));
	} else if ((V * l) <= 2e+274) {
		tmp = Math.sqrt(A) * (c0_m / Math.sqrt((V * l)));
	} else {
		tmp = Math.sqrt(((A * (c0_m * (c0_m / 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+302:
		tmp = math.sqrt((A / V)) * (c0_m * math.pow(l, -0.5))
	elif (V * l) <= -4e-307:
		tmp = c0_m * (math.sqrt(-A) / math.sqrt((V * -l)))
	elif (V * l) <= 0.0:
		tmp = c0_m / (math.sqrt(l) * math.sqrt((V / A)))
	elif (V * l) <= 2e+274:
		tmp = math.sqrt(A) * (c0_m / math.sqrt((V * l)))
	else:
		tmp = math.sqrt(((A * (c0_m * (c0_m / 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+302)
		tmp = Float64(sqrt(Float64(A / V)) * Float64(c0_m * (l ^ -0.5)));
	elseif (Float64(V * l) <= -4e-307)
		tmp = Float64(c0_m * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 0.0)
		tmp = Float64(c0_m / Float64(sqrt(l) * sqrt(Float64(V / A))));
	elseif (Float64(V * l) <= 2e+274)
		tmp = Float64(sqrt(A) * Float64(c0_m / sqrt(Float64(V * l))));
	else
		tmp = sqrt(Float64(Float64(A * Float64(c0_m * Float64(c0_m / 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+302)
		tmp = sqrt((A / V)) * (c0_m * (l ^ -0.5));
	elseif ((V * l) <= -4e-307)
		tmp = c0_m * (sqrt(-A) / sqrt((V * -l)));
	elseif ((V * l) <= 0.0)
		tmp = c0_m / (sqrt(l) * sqrt((V / A)));
	elseif ((V * l) <= 2e+274)
		tmp = sqrt(A) * (c0_m / sqrt((V * l)));
	else
		tmp = sqrt(((A * (c0_m * (c0_m / 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+302], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0$95$m * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -4e-307], 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[(c0$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+274], N[(N[Sqrt[A], $MachinePrecision] * N[(c0$95$m / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(A * N[(c0$95$m * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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^{+302}:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \left(c0\_m \cdot {\ell}^{-0.5}\right)\\

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

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

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

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


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

    1. Initial program 30.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000002e302 < (*.f64 V l) < -3.99999999999999964e-307

    1. Initial program 91.1%

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

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

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

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

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

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

    if -3.99999999999999964e-307 < (*.f64 V l) < -0.0

    1. Initial program 26.6%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 26.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 1.99999999999999984e274

    1. Initial program 84.7%

      \[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. associate-*r/94.7%

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

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

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

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

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

    if 1.99999999999999984e274 < (*.f64 V l)

    1. Initial program 23.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      7. pow222.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 83.6% 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])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 4 \cdot 10^{-317}:\\ \;\;\;\;\frac{\sqrt{\frac{A}{V}}}{\frac{\sqrt{\ell}}{c0\_m}}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+292}:\\ \;\;\;\;c0\_m \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \left(c0\_m \cdot \frac{1}{V}\right)\right)}{\ell}}\\ \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 (/ A (* V l))))
   (*
    c0_s
    (if (<= t_0 4e-317)
      (/ (sqrt (/ A V)) (/ (sqrt l) c0_m))
      (if (<= t_0 5e+292)
        (* c0_m (sqrt t_0))
        (sqrt (/ (* A (* c0_m (* c0_m (/ 1.0 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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 4e-317) {
		tmp = sqrt((A / V)) / (sqrt(l) / c0_m);
	} else if (t_0 <= 5e+292) {
		tmp = c0_m * sqrt(t_0);
	} else {
		tmp = sqrt(((A * (c0_m * (c0_m * (1.0 / 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) :: t_0
    real(8) :: tmp
    t_0 = a / (v * l)
    if (t_0 <= 4d-317) then
        tmp = sqrt((a / v)) / (sqrt(l) / c0_m)
    else if (t_0 <= 5d+292) then
        tmp = c0_m * sqrt(t_0)
    else
        tmp = sqrt(((a * (c0_m * (c0_m * (1.0d0 / 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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 4e-317) {
		tmp = Math.sqrt((A / V)) / (Math.sqrt(l) / c0_m);
	} else if (t_0 <= 5e+292) {
		tmp = c0_m * Math.sqrt(t_0);
	} else {
		tmp = Math.sqrt(((A * (c0_m * (c0_m * (1.0 / 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):
	t_0 = A / (V * l)
	tmp = 0
	if t_0 <= 4e-317:
		tmp = math.sqrt((A / V)) / (math.sqrt(l) / c0_m)
	elif t_0 <= 5e+292:
		tmp = c0_m * math.sqrt(t_0)
	else:
		tmp = math.sqrt(((A * (c0_m * (c0_m * (1.0 / 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)
	t_0 = Float64(A / Float64(V * l))
	tmp = 0.0
	if (t_0 <= 4e-317)
		tmp = Float64(sqrt(Float64(A / V)) / Float64(sqrt(l) / c0_m));
	elseif (t_0 <= 5e+292)
		tmp = Float64(c0_m * sqrt(t_0));
	else
		tmp = sqrt(Float64(Float64(A * Float64(c0_m * Float64(c0_m * Float64(1.0 / 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)
	t_0 = A / (V * l);
	tmp = 0.0;
	if (t_0 <= 4e-317)
		tmp = sqrt((A / V)) / (sqrt(l) / c0_m);
	elseif (t_0 <= 5e+292)
		tmp = c0_m * sqrt(t_0);
	else
		tmp = sqrt(((A * (c0_m * (c0_m * (1.0 / 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_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 4e-317], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / c0$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+292], N[(c0$95$m * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(A * N[(c0$95$m * N[(c0$95$m * N[(1.0 / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 4 \cdot 10^{-317}:\\
\;\;\;\;\frac{\sqrt{\frac{A}{V}}}{\frac{\sqrt{\ell}}{c0\_m}}\\

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

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


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

    1. Initial program 28.2%

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999993e-317 < (/.f64 A (*.f64 V l)) < 4.9999999999999996e292

    1. Initial program 99.5%

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

    if 4.9999999999999996e292 < (/.f64 A (*.f64 V l))

    1. Initial program 34.5%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      7. pow210.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 83.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])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 4 \cdot 10^{-317}:\\ \;\;\;\;\frac{c0\_m}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+292}:\\ \;\;\;\;c0\_m \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \left(c0\_m \cdot \frac{1}{V}\right)\right)}{\ell}}\\ \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 (/ A (* V l))))
   (*
    c0_s
    (if (<= t_0 4e-317)
      (* (/ c0_m (sqrt l)) (sqrt (/ A V)))
      (if (<= t_0 5e+292)
        (* c0_m (sqrt t_0))
        (sqrt (/ (* A (* c0_m (* c0_m (/ 1.0 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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 4e-317) {
		tmp = (c0_m / sqrt(l)) * sqrt((A / V));
	} else if (t_0 <= 5e+292) {
		tmp = c0_m * sqrt(t_0);
	} else {
		tmp = sqrt(((A * (c0_m * (c0_m * (1.0 / 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) :: t_0
    real(8) :: tmp
    t_0 = a / (v * l)
    if (t_0 <= 4d-317) then
        tmp = (c0_m / sqrt(l)) * sqrt((a / v))
    else if (t_0 <= 5d+292) then
        tmp = c0_m * sqrt(t_0)
    else
        tmp = sqrt(((a * (c0_m * (c0_m * (1.0d0 / 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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 4e-317) {
		tmp = (c0_m / Math.sqrt(l)) * Math.sqrt((A / V));
	} else if (t_0 <= 5e+292) {
		tmp = c0_m * Math.sqrt(t_0);
	} else {
		tmp = Math.sqrt(((A * (c0_m * (c0_m * (1.0 / 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):
	t_0 = A / (V * l)
	tmp = 0
	if t_0 <= 4e-317:
		tmp = (c0_m / math.sqrt(l)) * math.sqrt((A / V))
	elif t_0 <= 5e+292:
		tmp = c0_m * math.sqrt(t_0)
	else:
		tmp = math.sqrt(((A * (c0_m * (c0_m * (1.0 / 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)
	t_0 = Float64(A / Float64(V * l))
	tmp = 0.0
	if (t_0 <= 4e-317)
		tmp = Float64(Float64(c0_m / sqrt(l)) * sqrt(Float64(A / V)));
	elseif (t_0 <= 5e+292)
		tmp = Float64(c0_m * sqrt(t_0));
	else
		tmp = sqrt(Float64(Float64(A * Float64(c0_m * Float64(c0_m * Float64(1.0 / 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)
	t_0 = A / (V * l);
	tmp = 0.0;
	if (t_0 <= 4e-317)
		tmp = (c0_m / sqrt(l)) * sqrt((A / V));
	elseif (t_0 <= 5e+292)
		tmp = c0_m * sqrt(t_0);
	else
		tmp = sqrt(((A * (c0_m * (c0_m * (1.0 / 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_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 4e-317], N[(N[(c0$95$m / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+292], N[(c0$95$m * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(A * N[(c0$95$m * N[(c0$95$m * N[(1.0 / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 4 \cdot 10^{-317}:\\
\;\;\;\;\frac{c0\_m}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\\

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

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


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

    1. Initial program 28.2%

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

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

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

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

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

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

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

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

    if 3.99999993e-317 < (/.f64 A (*.f64 V l)) < 4.9999999999999996e292

    1. Initial program 99.5%

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

    if 4.9999999999999996e292 < (/.f64 A (*.f64 V l))

    1. Initial program 34.5%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      7. pow210.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 83.8% 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])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 4 \cdot 10^{-317}:\\ \;\;\;\;c0\_m \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+292}:\\ \;\;\;\;c0\_m \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \left(c0\_m \cdot \frac{1}{V}\right)\right)}{\ell}}\\ \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 (/ A (* V l))))
   (*
    c0_s
    (if (<= t_0 4e-317)
      (* c0_m (/ (sqrt (/ A V)) (sqrt l)))
      (if (<= t_0 5e+292)
        (* c0_m (sqrt t_0))
        (sqrt (/ (* A (* c0_m (* c0_m (/ 1.0 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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 4e-317) {
		tmp = c0_m * (sqrt((A / V)) / sqrt(l));
	} else if (t_0 <= 5e+292) {
		tmp = c0_m * sqrt(t_0);
	} else {
		tmp = sqrt(((A * (c0_m * (c0_m * (1.0 / 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) :: t_0
    real(8) :: tmp
    t_0 = a / (v * l)
    if (t_0 <= 4d-317) then
        tmp = c0_m * (sqrt((a / v)) / sqrt(l))
    else if (t_0 <= 5d+292) then
        tmp = c0_m * sqrt(t_0)
    else
        tmp = sqrt(((a * (c0_m * (c0_m * (1.0d0 / 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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 4e-317) {
		tmp = c0_m * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else if (t_0 <= 5e+292) {
		tmp = c0_m * Math.sqrt(t_0);
	} else {
		tmp = Math.sqrt(((A * (c0_m * (c0_m * (1.0 / 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):
	t_0 = A / (V * l)
	tmp = 0
	if t_0 <= 4e-317:
		tmp = c0_m * (math.sqrt((A / V)) / math.sqrt(l))
	elif t_0 <= 5e+292:
		tmp = c0_m * math.sqrt(t_0)
	else:
		tmp = math.sqrt(((A * (c0_m * (c0_m * (1.0 / 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)
	t_0 = Float64(A / Float64(V * l))
	tmp = 0.0
	if (t_0 <= 4e-317)
		tmp = Float64(c0_m * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	elseif (t_0 <= 5e+292)
		tmp = Float64(c0_m * sqrt(t_0));
	else
		tmp = sqrt(Float64(Float64(A * Float64(c0_m * Float64(c0_m * Float64(1.0 / 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)
	t_0 = A / (V * l);
	tmp = 0.0;
	if (t_0 <= 4e-317)
		tmp = c0_m * (sqrt((A / V)) / sqrt(l));
	elseif (t_0 <= 5e+292)
		tmp = c0_m * sqrt(t_0);
	else
		tmp = sqrt(((A * (c0_m * (c0_m * (1.0 / 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_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 4e-317], N[(c0$95$m * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+292], N[(c0$95$m * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(A * N[(c0$95$m * N[(c0$95$m * N[(1.0 / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 4 \cdot 10^{-317}:\\
\;\;\;\;c0\_m \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

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

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


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

    1. Initial program 28.2%

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

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

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

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

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

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

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

    if 3.99999993e-317 < (/.f64 A (*.f64 V l)) < 4.9999999999999996e292

    1. Initial program 99.5%

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

    if 4.9999999999999996e292 < (/.f64 A (*.f64 V l))

    1. Initial program 34.5%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      7. pow210.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 82.9% accurate, 0.8× 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 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \frac{c0\_m}{V}\right)}{\ell}}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+292}:\\ \;\;\;\;c0\_m \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \left(c0\_m \cdot \frac{1}{V}\right)\right)}{\ell}}\\ \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 (/ A (* V l))))
   (*
    c0_s
    (if (<= t_0 0.0)
      (sqrt (/ (* A (* c0_m (/ c0_m V))) l))
      (if (<= t_0 5e+292)
        (* c0_m (sqrt t_0))
        (sqrt (/ (* A (* c0_m (* c0_m (/ 1.0 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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = sqrt(((A * (c0_m * (c0_m / V))) / l));
	} else if (t_0 <= 5e+292) {
		tmp = c0_m * sqrt(t_0);
	} else {
		tmp = sqrt(((A * (c0_m * (c0_m * (1.0 / 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) :: t_0
    real(8) :: tmp
    t_0 = a / (v * l)
    if (t_0 <= 0.0d0) then
        tmp = sqrt(((a * (c0_m * (c0_m / v))) / l))
    else if (t_0 <= 5d+292) then
        tmp = c0_m * sqrt(t_0)
    else
        tmp = sqrt(((a * (c0_m * (c0_m * (1.0d0 / 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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = Math.sqrt(((A * (c0_m * (c0_m / V))) / l));
	} else if (t_0 <= 5e+292) {
		tmp = c0_m * Math.sqrt(t_0);
	} else {
		tmp = Math.sqrt(((A * (c0_m * (c0_m * (1.0 / 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):
	t_0 = A / (V * l)
	tmp = 0
	if t_0 <= 0.0:
		tmp = math.sqrt(((A * (c0_m * (c0_m / V))) / l))
	elif t_0 <= 5e+292:
		tmp = c0_m * math.sqrt(t_0)
	else:
		tmp = math.sqrt(((A * (c0_m * (c0_m * (1.0 / 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)
	t_0 = Float64(A / Float64(V * l))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = sqrt(Float64(Float64(A * Float64(c0_m * Float64(c0_m / V))) / l));
	elseif (t_0 <= 5e+292)
		tmp = Float64(c0_m * sqrt(t_0));
	else
		tmp = sqrt(Float64(Float64(A * Float64(c0_m * Float64(c0_m * Float64(1.0 / 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)
	t_0 = A / (V * l);
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = sqrt(((A * (c0_m * (c0_m / V))) / l));
	elseif (t_0 <= 5e+292)
		tmp = c0_m * sqrt(t_0);
	else
		tmp = sqrt(((A * (c0_m * (c0_m * (1.0 / 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_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 0.0], N[Sqrt[N[(N[(A * N[(c0$95$m * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$0, 5e+292], N[(c0$95$m * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(A * N[(c0$95$m * N[(c0$95$m * N[(1.0 / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \frac{c0\_m}{V}\right)}{\ell}}\\

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

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


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

    1. Initial program 27.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (/.f64 A (*.f64 V l)) < 4.9999999999999996e292

    1. Initial program 99.2%

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

    if 4.9999999999999996e292 < (/.f64 A (*.f64 V l))

    1. Initial program 34.5%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      7. pow210.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 82.9% accurate, 0.8× 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 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 5 \cdot 10^{+292}\right):\\ \;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \frac{c0\_m}{V}\right)}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0\_m \cdot \sqrt{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 (/ A (* V l))))
   (*
    c0_s
    (if (or (<= t_0 0.0) (not (<= t_0 5e+292)))
      (sqrt (/ (* A (* c0_m (/ c0_m V))) l))
      (* c0_m (sqrt 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 = A / (V * l);
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 5e+292)) {
		tmp = sqrt(((A * (c0_m * (c0_m / V))) / l));
	} else {
		tmp = c0_m * sqrt(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 = a / (v * l)
    if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 5d+292))) then
        tmp = sqrt(((a * (c0_m * (c0_m / v))) / l))
    else
        tmp = c0_m * sqrt(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 = A / (V * l);
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 5e+292)) {
		tmp = Math.sqrt(((A * (c0_m * (c0_m / V))) / l));
	} else {
		tmp = c0_m * Math.sqrt(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 = A / (V * l)
	tmp = 0
	if (t_0 <= 0.0) or not (t_0 <= 5e+292):
		tmp = math.sqrt(((A * (c0_m * (c0_m / V))) / l))
	else:
		tmp = c0_m * math.sqrt(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(A / Float64(V * l))
	tmp = 0.0
	if ((t_0 <= 0.0) || !(t_0 <= 5e+292))
		tmp = sqrt(Float64(Float64(A * Float64(c0_m * Float64(c0_m / V))) / l));
	else
		tmp = Float64(c0_m * sqrt(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 = A / (V * l);
	tmp = 0.0;
	if ((t_0 <= 0.0) || ~((t_0 <= 5e+292)))
		tmp = sqrt(((A * (c0_m * (c0_m / V))) / l));
	else
		tmp = c0_m * sqrt(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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 5e+292]], $MachinePrecision]], N[Sqrt[N[(N[(A * N[(c0$95$m * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision], N[(c0$95$m * N[Sqrt[t$95$0], $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 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 5 \cdot 10^{+292}\right):\\
\;\;\;\;\sqrt{\frac{A \cdot \left(c0\_m \cdot \frac{c0\_m}{V}\right)}{\ell}}\\

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


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

    1. Initial program 31.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (/.f64 A (*.f64 V l)) < 4.9999999999999996e292

    1. Initial program 99.2%

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

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

Alternative 11: 82.1% accurate, 0.8× 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 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 10^{+290}\right):\\ \;\;\;\;\sqrt{\left(c0\_m \cdot \frac{c0\_m}{V}\right) \cdot \frac{A}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0\_m \cdot \sqrt{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 (/ A (* V l))))
   (*
    c0_s
    (if (or (<= t_0 0.0) (not (<= t_0 1e+290)))
      (sqrt (* (* c0_m (/ c0_m V)) (/ A l)))
      (* c0_m (sqrt 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 = A / (V * l);
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 1e+290)) {
		tmp = sqrt(((c0_m * (c0_m / V)) * (A / l)));
	} else {
		tmp = c0_m * sqrt(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 = a / (v * l)
    if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 1d+290))) then
        tmp = sqrt(((c0_m * (c0_m / v)) * (a / l)))
    else
        tmp = c0_m * sqrt(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 = A / (V * l);
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 1e+290)) {
		tmp = Math.sqrt(((c0_m * (c0_m / V)) * (A / l)));
	} else {
		tmp = c0_m * Math.sqrt(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 = A / (V * l)
	tmp = 0
	if (t_0 <= 0.0) or not (t_0 <= 1e+290):
		tmp = math.sqrt(((c0_m * (c0_m / V)) * (A / l)))
	else:
		tmp = c0_m * math.sqrt(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(A / Float64(V * l))
	tmp = 0.0
	if ((t_0 <= 0.0) || !(t_0 <= 1e+290))
		tmp = sqrt(Float64(Float64(c0_m * Float64(c0_m / V)) * Float64(A / l)));
	else
		tmp = Float64(c0_m * sqrt(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 = A / (V * l);
	tmp = 0.0;
	if ((t_0 <= 0.0) || ~((t_0 <= 1e+290)))
		tmp = sqrt(((c0_m * (c0_m / V)) * (A / l)));
	else
		tmp = c0_m * sqrt(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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 1e+290]], $MachinePrecision]], N[Sqrt[N[(N[(c0$95$m * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision] * N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(c0$95$m * N[Sqrt[t$95$0], $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 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 10^{+290}\right):\\
\;\;\;\;\sqrt{\left(c0\_m \cdot \frac{c0\_m}{V}\right) \cdot \frac{A}{\ell}}\\

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


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

    1. Initial program 32.1%

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V \cdot \ell}} \cdot \left(c0 \cdot c0\right)} \]
      7. pow217.8%

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

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

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

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

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

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

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

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

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

    if 0.0 < (/.f64 A (*.f64 V l)) < 1.00000000000000006e290

    1. Initial program 99.2%

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

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

Alternative 12: 80.5% accurate, 0.9× 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 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 4 \cdot 10^{+269}\right):\\ \;\;\;\;\frac{c0\_m}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0\_m \cdot \sqrt{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 (/ A (* V l))))
   (*
    c0_s
    (if (or (<= t_0 0.0) (not (<= t_0 4e+269)))
      (/ c0_m (sqrt (* V (/ l A))))
      (* c0_m (sqrt 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 = A / (V * l);
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 4e+269)) {
		tmp = c0_m / sqrt((V * (l / A)));
	} else {
		tmp = c0_m * sqrt(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 = a / (v * l)
    if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 4d+269))) then
        tmp = c0_m / sqrt((v * (l / a)))
    else
        tmp = c0_m * sqrt(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 = A / (V * l);
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 4e+269)) {
		tmp = c0_m / Math.sqrt((V * (l / A)));
	} else {
		tmp = c0_m * Math.sqrt(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 = A / (V * l)
	tmp = 0
	if (t_0 <= 0.0) or not (t_0 <= 4e+269):
		tmp = c0_m / math.sqrt((V * (l / A)))
	else:
		tmp = c0_m * math.sqrt(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(A / Float64(V * l))
	tmp = 0.0
	if ((t_0 <= 0.0) || !(t_0 <= 4e+269))
		tmp = Float64(c0_m / sqrt(Float64(V * Float64(l / A))));
	else
		tmp = Float64(c0_m * sqrt(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 = A / (V * l);
	tmp = 0.0;
	if ((t_0 <= 0.0) || ~((t_0 <= 4e+269)))
		tmp = c0_m / sqrt((V * (l / A)));
	else
		tmp = c0_m * sqrt(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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 4e+269]], $MachinePrecision]], N[(c0$95$m / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0$95$m * N[Sqrt[t$95$0], $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 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 4 \cdot 10^{+269}\right):\\
\;\;\;\;\frac{c0\_m}{\sqrt{V \cdot \frac{\ell}{A}}}\\

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


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

    1. Initial program 34.6%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 34.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.4%

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

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

Alternative 13: 80.2% accurate, 0.9× 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 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 10^{+275}\right):\\ \;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0\_m \cdot \sqrt{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 (/ A (* V l))))
   (*
    c0_s
    (if (or (<= t_0 0.0) (not (<= t_0 1e+275)))
      (* c0_m (sqrt (/ (/ A V) l)))
      (* c0_m (sqrt 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 = A / (V * l);
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 1e+275)) {
		tmp = c0_m * sqrt(((A / V) / l));
	} else {
		tmp = c0_m * sqrt(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 = a / (v * l)
    if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 1d+275))) then
        tmp = c0_m * sqrt(((a / v) / l))
    else
        tmp = c0_m * sqrt(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 = A / (V * l);
	double tmp;
	if ((t_0 <= 0.0) || !(t_0 <= 1e+275)) {
		tmp = c0_m * Math.sqrt(((A / V) / l));
	} else {
		tmp = c0_m * Math.sqrt(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 = A / (V * l)
	tmp = 0
	if (t_0 <= 0.0) or not (t_0 <= 1e+275):
		tmp = c0_m * math.sqrt(((A / V) / l))
	else:
		tmp = c0_m * math.sqrt(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(A / Float64(V * l))
	tmp = 0.0
	if ((t_0 <= 0.0) || !(t_0 <= 1e+275))
		tmp = Float64(c0_m * sqrt(Float64(Float64(A / V) / l)));
	else
		tmp = Float64(c0_m * sqrt(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 = A / (V * l);
	tmp = 0.0;
	if ((t_0 <= 0.0) || ~((t_0 <= 1e+275)))
		tmp = c0_m * sqrt(((A / V) / l));
	else
		tmp = c0_m * sqrt(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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 1e+275]], $MachinePrecision]], N[(c0$95$m * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0$95$m * N[Sqrt[t$95$0], $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 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 10^{+275}\right):\\
\;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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


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

    1. Initial program 33.9%

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

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

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

    if 0.0 < (/.f64 A (*.f64 V l)) < 9.9999999999999996e274

    1. Initial program 99.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{A}{V \cdot \ell} \leq 0 \lor \neg \left(\frac{A}{V \cdot \ell} \leq 10^{+275}\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 14: 80.5% accurate, 0.9× 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 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\frac{c0\_m}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;t\_0 \leq 10^{+275}:\\ \;\;\;\;c0\_m \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0\_m}{\sqrt{\ell \cdot \frac{V}{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 (/ A (* V l))))
   (*
    c0_s
    (if (<= t_0 0.0)
      (/ c0_m (sqrt (* V (/ l A))))
      (if (<= t_0 1e+275)
        (* c0_m (sqrt t_0))
        (/ c0_m (sqrt (* l (/ V 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 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = c0_m / sqrt((V * (l / A)));
	} else if (t_0 <= 1e+275) {
		tmp = c0_m * sqrt(t_0);
	} else {
		tmp = c0_m / sqrt((l * (V / 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 = a / (v * l)
    if (t_0 <= 0.0d0) then
        tmp = c0_m / sqrt((v * (l / a)))
    else if (t_0 <= 1d+275) then
        tmp = c0_m * sqrt(t_0)
    else
        tmp = c0_m / sqrt((l * (v / 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 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = c0_m / Math.sqrt((V * (l / A)));
	} else if (t_0 <= 1e+275) {
		tmp = c0_m * Math.sqrt(t_0);
	} else {
		tmp = c0_m / Math.sqrt((l * (V / 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 = A / (V * l)
	tmp = 0
	if t_0 <= 0.0:
		tmp = c0_m / math.sqrt((V * (l / A)))
	elif t_0 <= 1e+275:
		tmp = c0_m * math.sqrt(t_0)
	else:
		tmp = c0_m / math.sqrt((l * (V / 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(A / Float64(V * l))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = Float64(c0_m / sqrt(Float64(V * Float64(l / A))));
	elseif (t_0 <= 1e+275)
		tmp = Float64(c0_m * sqrt(t_0));
	else
		tmp = Float64(c0_m / sqrt(Float64(l * Float64(V / 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 = A / (V * l);
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = c0_m / sqrt((V * (l / A)));
	elseif (t_0 <= 1e+275)
		tmp = c0_m * sqrt(t_0);
	else
		tmp = c0_m / sqrt((l * (V / 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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 0.0], N[(c0$95$m / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+275], N[(c0$95$m * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0$95$m / N[Sqrt[N[(l * N[(V / 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 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{c0\_m}{\sqrt{V \cdot \frac{\ell}{A}}}\\

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

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


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

    1. Initial program 27.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 27.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (/.f64 A (*.f64 V l)) < 9.9999999999999996e274

    1. Initial program 99.4%

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

    if 9.9999999999999996e274 < (/.f64 A (*.f64 V l))

    1. Initial program 38.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 38.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 80.2% accurate, 0.9× 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 := \frac{A}{V \cdot \ell}\\ c0\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;t\_0 \leq 10^{+275}:\\ \;\;\;\;c0\_m \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \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 (/ A (* V l))))
   (*
    c0_s
    (if (<= t_0 0.0)
      (* c0_m (sqrt (/ (/ A l) V)))
      (if (<= t_0 1e+275)
        (* c0_m (sqrt t_0))
        (* 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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = c0_m * sqrt(((A / l) / V));
	} else if (t_0 <= 1e+275) {
		tmp = c0_m * sqrt(t_0);
	} 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) :: t_0
    real(8) :: tmp
    t_0 = a / (v * l)
    if (t_0 <= 0.0d0) then
        tmp = c0_m * sqrt(((a / l) / v))
    else if (t_0 <= 1d+275) then
        tmp = c0_m * sqrt(t_0)
    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 t_0 = A / (V * l);
	double tmp;
	if (t_0 <= 0.0) {
		tmp = c0_m * Math.sqrt(((A / l) / V));
	} else if (t_0 <= 1e+275) {
		tmp = c0_m * Math.sqrt(t_0);
	} 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):
	t_0 = A / (V * l)
	tmp = 0
	if t_0 <= 0.0:
		tmp = c0_m * math.sqrt(((A / l) / V))
	elif t_0 <= 1e+275:
		tmp = c0_m * math.sqrt(t_0)
	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)
	t_0 = Float64(A / Float64(V * l))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = Float64(c0_m * sqrt(Float64(Float64(A / l) / V)));
	elseif (t_0 <= 1e+275)
		tmp = Float64(c0_m * sqrt(t_0));
	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)
	t_0 = A / (V * l);
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = c0_m * sqrt(((A / l) / V));
	elseif (t_0 <= 1e+275)
		tmp = c0_m * sqrt(t_0);
	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_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 0.0], N[(c0$95$m * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+275], N[(c0$95$m * N[Sqrt[t$95$0], $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])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\

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

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


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

    1. Initial program 27.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in c0 around 0 27.5%

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

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

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

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

    if 0.0 < (/.f64 A (*.f64 V l)) < 9.9999999999999996e274

    1. Initial program 99.4%

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

    if 9.9999999999999996e274 < (/.f64 A (*.f64 V l))

    1. Initial program 38.8%

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

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

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

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

Alternative 16: 73.9% 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 74.6%

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

Reproduce

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