Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.2% → 91.5%
Time: 8.3s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 74.2% accurate, 1.0× speedup?

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

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

Alternative 1: 91.5% accurate, 0.3× speedup?

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

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

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

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

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


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

    1. Initial program 38.1%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6471.1

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lift-/.f64N/A

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. lift-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\frac{A}{V}}}}{\sqrt{\ell}} \]
      6. lift-sqrt.f64N/A

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

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      8. *-commutativeN/A

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

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}} \]
      10. lift-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      11. lift-/.f64N/A

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      12. clear-numN/A

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{V}{A}}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      14. metadata-evalN/A

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

        \[\leadsto \color{blue}{\frac{1 \cdot c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}} \]
      16. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{c0 \cdot 1}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      17. *-rgt-identityN/A

        \[\leadsto \frac{\color{blue}{c0}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      18. lift-sqrt.f64N/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
      21. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\ell}}}}} \]
      22. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}} \]
      23. lower-sqrt.f64N/A

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

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

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

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{1}{\frac{\frac{1}{\ell}}{\frac{V}{A}}}}}} \]
      5. clear-numN/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{{\ell}^{-1}} \cdot A}}} \]
      8. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\ell}^{\color{blue}{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \cdot A}}} \]
      9. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\ell}^{\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} + \frac{-1}{2}\right)} \cdot A}}} \]
      10. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\ell}^{\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)} \cdot A}}} \]
      11. pow-prod-upN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\left({\ell}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot {\ell}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)} \cdot A}}} \]
      12. pow-prod-downN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{{\left(\ell \cdot \ell\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \cdot A}}} \]
      13. remove-double-negN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right)} \cdot \ell\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      14. lift-neg.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\ell\right)\right)}\right)\right) \cdot \ell\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      15. remove-double-negN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right)}\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      16. lift-neg.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\ell\right)\right)}\right)\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      17. sqr-negN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\color{blue}{\left(\left(\mathsf{neg}\left(\ell\right)\right) \cdot \left(\mathsf{neg}\left(\ell\right)\right)\right)}}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      18. pow-prod-downN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\left({\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot {\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)} \cdot A}}} \]
      19. pow-prod-upN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}} \cdot A}}} \]
      20. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\color{blue}{\frac{-1}{2}} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} \cdot A}}} \]
      21. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\frac{-1}{2} + \color{blue}{\frac{-1}{2}}\right)} \cdot A}}} \]
      22. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\color{blue}{-1}} \cdot A}}} \]
      23. inv-powN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{1}{\mathsf{neg}\left(\ell\right)}} \cdot A}}} \]
      24. *-commutativeN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{A \cdot \frac{1}{\mathsf{neg}\left(\ell\right)}}}}} \]
      25. div-invN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}}}} \]
      26. lift-/.f64N/A

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

      \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
    9. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\ell}}}}} \]
      2. frac-2negN/A

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\mathsf{neg}\left(V\right)}{\mathsf{neg}\left(\frac{A}{\ell}\right)}}}} \]
      3. sqrt-divN/A

        \[\leadsto \frac{c0}{\color{blue}{\frac{\sqrt{\mathsf{neg}\left(V\right)}}{\sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}}}} \]
      4. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\mathsf{neg}\left(V\right)}} \cdot \sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\mathsf{neg}\left(V\right)}} \cdot \sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}} \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\mathsf{neg}\left(V\right)}}} \cdot \sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)} \]
      7. lower-sqrt.f64N/A

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\mathsf{neg}\left(V\right)}}} \cdot \sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)} \]
      8. lower-neg.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\mathsf{neg}\left(V\right)}}} \cdot \sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)} \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)}} \cdot \color{blue}{\sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}} \]
      10. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)}} \cdot \sqrt{\mathsf{neg}\left(\color{blue}{\frac{A}{\ell}}\right)} \]
      11. distribute-neg-frac2N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)}} \cdot \sqrt{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)}} \cdot \sqrt{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}} \]
      13. lower-neg.f6465.1

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

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

    if -4.9999999999999998e274 < (*.f64 V l) < -9.9999999996e-315

    1. Initial program 84.5%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6475.6

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{A}{V \cdot \ell}}} \]
      2. lift-*.f64N/A

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(A\right)}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      4. sqrt-divN/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      5. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      6. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\mathsf{neg}\left(A\right)}}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}} \]
      7. lower-neg.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\mathsf{neg}\left(A\right)}}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}} \]
      8. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      9. lift-*.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(\color{blue}{V \cdot \ell}\right)}} \]
      10. *-commutativeN/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(\color{blue}{\ell \cdot V}\right)}} \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\color{blue}{\ell \cdot \left(\mathsf{neg}\left(V\right)\right)}}} \]
      12. lower-*.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\color{blue}{\ell \cdot \left(\mathsf{neg}\left(V\right)\right)}}} \]
      13. lower-neg.f6499.2

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

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

    if -9.9999999996e-315 < (*.f64 V l) < 0.0

    1. Initial program 42.9%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6465.0

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

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

    if 0.0 < (*.f64 V l) < 5e287

    1. Initial program 86.7%

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      3. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      4. lower-sqrt.f64N/A

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

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

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

    if 5e287 < (*.f64 V l)

    1. Initial program 48.6%

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{A \cdot \frac{1}{V \cdot \ell}}} \]
      3. inv-powN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{{\left(V \cdot \ell\right)}^{-1}}} \]
      4. metadata-evalN/A

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

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

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

        \[\leadsto c0 \cdot \sqrt{A \cdot {\color{blue}{\left(\left(V \cdot \ell\right) \cdot \left(V \cdot \ell\right)\right)}}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      8. remove-double-negN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right)} \cdot \left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      9. remove-double-negN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right)}\right)}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      10. sqr-negN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\color{blue}{\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right) \cdot \left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)}}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      11. pow-prod-downN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{\left({\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2}\right)} \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2}\right)}\right)}} \]
      12. pow-prod-upN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{{\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2} + -1 \cdot \frac{1}{2}\right)}}} \]
      13. metadata-evalN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(\color{blue}{\frac{-1}{2}} + -1 \cdot \frac{1}{2}\right)}} \]
      14. metadata-evalN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(\frac{-1}{2} + \color{blue}{\frac{-1}{2}}\right)}} \]
      15. metadata-evalN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\color{blue}{-1}}} \]
      16. inv-powN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      17. div-invN/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{A}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      18. lift-*.f64N/A

        \[\leadsto c0 \cdot \sqrt{\frac{A}{\mathsf{neg}\left(\color{blue}{V \cdot \ell}\right)}} \]
      19. distribute-lft-neg-inN/A

        \[\leadsto c0 \cdot \sqrt{\frac{A}{\color{blue}{\left(\mathsf{neg}\left(V\right)\right) \cdot \ell}}} \]
      20. associate-/r*N/A

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

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

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

Alternative 2: 77.2% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 70.6%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lower-/.f6472.1

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

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

    if 9.9999999999999999e-232 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 2.00000000000000014e246

    1. Initial program 98.4%

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

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

    1. Initial program 47.1%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6457.1

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lift-/.f64N/A

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. lift-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\frac{A}{V}}}}{\sqrt{\ell}} \]
      6. lift-sqrt.f64N/A

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

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      8. *-commutativeN/A

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

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}} \]
      10. lift-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      11. lift-/.f64N/A

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      12. clear-numN/A

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{V}{A}}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      14. metadata-evalN/A

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

        \[\leadsto \color{blue}{\frac{1 \cdot c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}} \]
      16. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{c0 \cdot 1}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      17. *-rgt-identityN/A

        \[\leadsto \frac{\color{blue}{c0}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      18. lift-sqrt.f64N/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
      21. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\ell}}}}} \]
      22. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}} \]
      23. lower-sqrt.f64N/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
      3. lower-/.f6457.0

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

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

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

Alternative 3: 76.8% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 70.6%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lower-/.f6472.1

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

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

    if 9.9999999999999999e-232 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 2.00000000000000008e192

    1. Initial program 98.4%

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

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

    1. Initial program 50.5%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6459.9

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

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

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

Alternative 4: 77.0% accurate, 0.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 9.9999999999999999e-232 or 4.99999999999999982e277 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 67.1%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lower-/.f6470.3

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

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

    if 9.9999999999999999e-232 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 4.99999999999999982e277

    1. Initial program 98.5%

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

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

Alternative 5: 91.5% accurate, 0.3× speedup?

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

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

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

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

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


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

    1. Initial program 38.1%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6471.1

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(\frac{A}{\ell}\right)}{\mathsf{neg}\left(V\right)}}} \]
      3. sqrt-divN/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}}{\sqrt{\mathsf{neg}\left(V\right)}}} \]
      4. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}}{\sqrt{\mathsf{neg}\left(V\right)}}} \]
      5. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      6. lift-/.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\frac{A}{\ell}}\right)}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      7. distribute-neg-frac2N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      9. lower-neg.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\frac{A}{\color{blue}{\mathsf{neg}\left(\ell\right)}}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      10. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\frac{A}{\mathsf{neg}\left(\ell\right)}}}{\color{blue}{\sqrt{\mathsf{neg}\left(V\right)}}} \]
      11. lower-neg.f6465.0

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

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

    if -4.9999999999999998e274 < (*.f64 V l) < -9.9999999996e-315

    1. Initial program 84.5%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6475.6

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{A}{V \cdot \ell}}} \]
      2. lift-*.f64N/A

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(A\right)}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      4. sqrt-divN/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      5. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      6. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\mathsf{neg}\left(A\right)}}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}} \]
      7. lower-neg.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\mathsf{neg}\left(A\right)}}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}} \]
      8. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      9. lift-*.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(\color{blue}{V \cdot \ell}\right)}} \]
      10. *-commutativeN/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(\color{blue}{\ell \cdot V}\right)}} \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\color{blue}{\ell \cdot \left(\mathsf{neg}\left(V\right)\right)}}} \]
      12. lower-*.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\color{blue}{\ell \cdot \left(\mathsf{neg}\left(V\right)\right)}}} \]
      13. lower-neg.f6499.2

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

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

    if -9.9999999996e-315 < (*.f64 V l) < 0.0

    1. Initial program 42.9%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6465.0

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

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

    if 0.0 < (*.f64 V l) < 5e287

    1. Initial program 86.7%

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      3. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      4. lower-sqrt.f64N/A

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

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

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

    if 5e287 < (*.f64 V l)

    1. Initial program 48.6%

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{A \cdot \frac{1}{V \cdot \ell}}} \]
      3. inv-powN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{{\left(V \cdot \ell\right)}^{-1}}} \]
      4. metadata-evalN/A

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

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

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

        \[\leadsto c0 \cdot \sqrt{A \cdot {\color{blue}{\left(\left(V \cdot \ell\right) \cdot \left(V \cdot \ell\right)\right)}}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      8. remove-double-negN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right)} \cdot \left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      9. remove-double-negN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right)}\right)}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      10. sqr-negN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\color{blue}{\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right) \cdot \left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)}}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      11. pow-prod-downN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{\left({\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2}\right)} \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2}\right)}\right)}} \]
      12. pow-prod-upN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{{\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2} + -1 \cdot \frac{1}{2}\right)}}} \]
      13. metadata-evalN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(\color{blue}{\frac{-1}{2}} + -1 \cdot \frac{1}{2}\right)}} \]
      14. metadata-evalN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(\frac{-1}{2} + \color{blue}{\frac{-1}{2}}\right)}} \]
      15. metadata-evalN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\color{blue}{-1}}} \]
      16. inv-powN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      17. div-invN/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{A}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      18. lift-*.f64N/A

        \[\leadsto c0 \cdot \sqrt{\frac{A}{\mathsf{neg}\left(\color{blue}{V \cdot \ell}\right)}} \]
      19. distribute-lft-neg-inN/A

        \[\leadsto c0 \cdot \sqrt{\frac{A}{\color{blue}{\left(\mathsf{neg}\left(V\right)\right) \cdot \ell}}} \]
      20. associate-/r*N/A

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

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

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

Alternative 6: 90.2% accurate, 0.3× speedup?

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

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

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

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

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


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

    1. Initial program 28.5%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lower-/.f6470.0

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

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

    if -inf.0 < (*.f64 V l) < -9.9999999996e-315

    1. Initial program 84.2%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6475.7

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{A}{V \cdot \ell}}} \]
      2. lift-*.f64N/A

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(A\right)}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      4. sqrt-divN/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      5. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      6. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\mathsf{neg}\left(A\right)}}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}} \]
      7. lower-neg.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\mathsf{neg}\left(A\right)}}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}} \]
      8. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      9. lift-*.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(\color{blue}{V \cdot \ell}\right)}} \]
      10. *-commutativeN/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(\color{blue}{\ell \cdot V}\right)}} \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\color{blue}{\ell \cdot \left(\mathsf{neg}\left(V\right)\right)}}} \]
      12. lower-*.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\color{blue}{\ell \cdot \left(\mathsf{neg}\left(V\right)\right)}}} \]
      13. lower-neg.f6499.2

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

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

    if -9.9999999996e-315 < (*.f64 V l) < 0.0

    1. Initial program 42.9%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6465.0

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

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

    if 0.0 < (*.f64 V l) < 5e287

    1. Initial program 86.7%

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      3. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      4. lower-sqrt.f64N/A

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

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

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

    if 5e287 < (*.f64 V l)

    1. Initial program 48.6%

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{A \cdot \frac{1}{V \cdot \ell}}} \]
      3. inv-powN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{{\left(V \cdot \ell\right)}^{-1}}} \]
      4. metadata-evalN/A

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

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

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

        \[\leadsto c0 \cdot \sqrt{A \cdot {\color{blue}{\left(\left(V \cdot \ell\right) \cdot \left(V \cdot \ell\right)\right)}}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      8. remove-double-negN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right)} \cdot \left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      9. remove-double-negN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right)}\right)}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      10. sqr-negN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\color{blue}{\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right) \cdot \left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)}}^{\left(-1 \cdot \frac{1}{2}\right)}} \]
      11. pow-prod-downN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{\left({\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2}\right)} \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2}\right)}\right)}} \]
      12. pow-prod-upN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{{\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(-1 \cdot \frac{1}{2} + -1 \cdot \frac{1}{2}\right)}}} \]
      13. metadata-evalN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(\color{blue}{\frac{-1}{2}} + -1 \cdot \frac{1}{2}\right)}} \]
      14. metadata-evalN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\left(\frac{-1}{2} + \color{blue}{\frac{-1}{2}}\right)}} \]
      15. metadata-evalN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot {\left(\mathsf{neg}\left(V \cdot \ell\right)\right)}^{\color{blue}{-1}}} \]
      16. inv-powN/A

        \[\leadsto c0 \cdot \sqrt{A \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      17. div-invN/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{A}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      18. lift-*.f64N/A

        \[\leadsto c0 \cdot \sqrt{\frac{A}{\mathsf{neg}\left(\color{blue}{V \cdot \ell}\right)}} \]
      19. distribute-lft-neg-inN/A

        \[\leadsto c0 \cdot \sqrt{\frac{A}{\color{blue}{\left(\mathsf{neg}\left(V\right)\right) \cdot \ell}}} \]
      20. associate-/r*N/A

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

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

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

Alternative 7: 90.2% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 40.1%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lower-/.f6470.6

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

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

    if -inf.0 < (*.f64 V l) < -9.9999999996e-315

    1. Initial program 84.2%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6475.7

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{A}{V \cdot \ell}}} \]
      2. lift-*.f64N/A

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(A\right)}{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      4. sqrt-divN/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      5. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      6. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\mathsf{neg}\left(A\right)}}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}} \]
      7. lower-neg.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\mathsf{neg}\left(A\right)}}}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}} \]
      8. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(V \cdot \ell\right)}}} \]
      9. lift-*.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(\color{blue}{V \cdot \ell}\right)}} \]
      10. *-commutativeN/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(\color{blue}{\ell \cdot V}\right)}} \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\color{blue}{\ell \cdot \left(\mathsf{neg}\left(V\right)\right)}}} \]
      12. lower-*.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\color{blue}{\ell \cdot \left(\mathsf{neg}\left(V\right)\right)}}} \]
      13. lower-neg.f6499.2

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

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

    if -9.9999999996e-315 < (*.f64 V l) < 0.0

    1. Initial program 42.9%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6465.0

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

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

    if 0.0 < (*.f64 V l) < 5e287

    1. Initial program 86.7%

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      3. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      4. lower-sqrt.f64N/A

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

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

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

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

Alternative 8: 88.1% accurate, 0.5× speedup?

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

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


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

    1. Initial program 74.3%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6474.4

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lift-/.f64N/A

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. lift-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\frac{A}{V}}}}{\sqrt{\ell}} \]
      6. lift-sqrt.f64N/A

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

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      8. *-commutativeN/A

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

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}} \]
      10. lift-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      11. lift-/.f64N/A

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      12. frac-2negN/A

        \[\leadsto \sqrt{\color{blue}{\frac{\mathsf{neg}\left(A\right)}{\mathsf{neg}\left(V\right)}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      13. sqrt-divN/A

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V\right)}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      14. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)} \cdot \frac{c0}{\sqrt{\ell}}}{\sqrt{\mathsf{neg}\left(V\right)}}} \]
      15. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)} \cdot \frac{c0}{\sqrt{\ell}}}{\sqrt{\mathsf{neg}\left(V\right)}}} \]
      16. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{neg}\left(A\right)} \cdot \frac{c0}{\sqrt{\ell}}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      17. lower-sqrt.f64N/A

        \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{neg}\left(A\right)}} \cdot \frac{c0}{\sqrt{\ell}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      18. lower-neg.f64N/A

        \[\leadsto \frac{\sqrt{\color{blue}{\mathsf{neg}\left(A\right)}} \cdot \frac{c0}{\sqrt{\ell}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      19. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\mathsf{neg}\left(A\right)} \cdot \color{blue}{\frac{c0}{\sqrt{\ell}}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      20. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{\mathsf{neg}\left(A\right)} \cdot \frac{c0}{\sqrt{\ell}}}{\color{blue}{\sqrt{\mathsf{neg}\left(V\right)}}} \]
      21. lower-neg.f6442.8

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

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

    if -1.000000000000002e-309 < A

    1. Initial program 73.1%

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      3. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      4. lower-sqrt.f64N/A

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

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

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

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

Alternative 9: 81.5% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 69.5%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6472.8

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lift-/.f64N/A

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. lift-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\frac{A}{V}}}}{\sqrt{\ell}} \]
      6. lift-sqrt.f64N/A

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

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      8. *-commutativeN/A

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

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}} \]
      10. lift-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      11. lift-/.f64N/A

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      12. clear-numN/A

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{V}{A}}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      14. metadata-evalN/A

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

        \[\leadsto \color{blue}{\frac{1 \cdot c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}} \]
      16. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{c0 \cdot 1}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      17. *-rgt-identityN/A

        \[\leadsto \frac{\color{blue}{c0}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      18. lift-sqrt.f64N/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
      21. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\ell}}}}} \]
      22. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}} \]
      23. lower-sqrt.f64N/A

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

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

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

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{1}{\frac{\frac{1}{\ell}}{\frac{V}{A}}}}}} \]
      5. clear-numN/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{{\ell}^{-1}} \cdot A}}} \]
      8. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\ell}^{\color{blue}{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \cdot A}}} \]
      9. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\ell}^{\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} + \frac{-1}{2}\right)} \cdot A}}} \]
      10. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\ell}^{\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)} \cdot A}}} \]
      11. pow-prod-upN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\left({\ell}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot {\ell}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)} \cdot A}}} \]
      12. pow-prod-downN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{{\left(\ell \cdot \ell\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \cdot A}}} \]
      13. remove-double-negN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right)} \cdot \ell\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      14. lift-neg.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\ell\right)\right)}\right)\right) \cdot \ell\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      15. remove-double-negN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right)}\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      16. lift-neg.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\ell\right)\right)}\right)\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      17. sqr-negN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\color{blue}{\left(\left(\mathsf{neg}\left(\ell\right)\right) \cdot \left(\mathsf{neg}\left(\ell\right)\right)\right)}}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      18. pow-prod-downN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\left({\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot {\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)} \cdot A}}} \]
      19. pow-prod-upN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}} \cdot A}}} \]
      20. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\color{blue}{\frac{-1}{2}} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} \cdot A}}} \]
      21. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\frac{-1}{2} + \color{blue}{\frac{-1}{2}}\right)} \cdot A}}} \]
      22. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\color{blue}{-1}} \cdot A}}} \]
      23. inv-powN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{1}{\mathsf{neg}\left(\ell\right)}} \cdot A}}} \]
      24. *-commutativeN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{A \cdot \frac{1}{\mathsf{neg}\left(\ell\right)}}}}} \]
      25. div-invN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}}}} \]
      26. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}}}} \]
    8. Applied egg-rr72.9%

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

    if 0.0 < (*.f64 V l) < 5e287

    1. Initial program 86.7%

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      3. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      4. lower-sqrt.f64N/A

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

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

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

    if 5e287 < (*.f64 V l)

    1. Initial program 48.6%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lower-/.f6471.0

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

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

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

Alternative 10: 81.4% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 69.5%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6472.8

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lift-/.f64N/A

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. lift-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\frac{A}{V}}}}{\sqrt{\ell}} \]
      6. lift-sqrt.f64N/A

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

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      8. *-commutativeN/A

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

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}} \]
      10. lift-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      11. lift-/.f64N/A

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      12. clear-numN/A

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{V}{A}}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      14. metadata-evalN/A

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

        \[\leadsto \color{blue}{\frac{1 \cdot c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}} \]
      16. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{c0 \cdot 1}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      17. *-rgt-identityN/A

        \[\leadsto \frac{\color{blue}{c0}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      18. lift-sqrt.f64N/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
      21. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\ell}}}}} \]
      22. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}} \]
      23. lower-sqrt.f64N/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
      3. lower-/.f6472.3

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

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

    if 0.0 < (*.f64 V l) < 5e287

    1. Initial program 86.7%

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      3. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \]
      4. lower-sqrt.f64N/A

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

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

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

    if 5e287 < (*.f64 V l)

    1. Initial program 48.6%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lower-/.f6471.0

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

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

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

Alternative 11: 86.8% accurate, 0.6× speedup?

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

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


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

    1. Initial program 71.3%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6475.0

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      3. lift-/.f64N/A

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      5. lift-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\frac{A}{V}}}}{\sqrt{\ell}} \]
      6. lift-sqrt.f64N/A

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

        \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}} \]
      8. *-commutativeN/A

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

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}} \]
      10. lift-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      11. lift-/.f64N/A

        \[\leadsto \sqrt{\color{blue}{\frac{A}{V}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      12. clear-numN/A

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{V}{A}}}} \cdot \frac{c0}{\sqrt{\ell}} \]
      14. metadata-evalN/A

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

        \[\leadsto \color{blue}{\frac{1 \cdot c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}} \]
      16. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{c0 \cdot 1}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      17. *-rgt-identityN/A

        \[\leadsto \frac{\color{blue}{c0}}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}} \]
      18. lift-sqrt.f64N/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
      21. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\ell}}}}} \]
      22. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}} \]
      23. lower-sqrt.f64N/A

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

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

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

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{1}{\frac{\frac{1}{\ell}}{\frac{V}{A}}}}}} \]
      5. clear-numN/A

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

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

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{{\ell}^{-1}} \cdot A}}} \]
      8. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\ell}^{\color{blue}{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \cdot A}}} \]
      9. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\ell}^{\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} + \frac{-1}{2}\right)} \cdot A}}} \]
      10. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\ell}^{\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)} \cdot A}}} \]
      11. pow-prod-upN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\left({\ell}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot {\ell}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)} \cdot A}}} \]
      12. pow-prod-downN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{{\left(\ell \cdot \ell\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \cdot A}}} \]
      13. remove-double-negN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right)} \cdot \ell\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      14. lift-neg.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\ell\right)\right)}\right)\right) \cdot \ell\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      15. remove-double-negN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right)}\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      16. lift-neg.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\ell\right)\right)}\right)\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      17. sqr-negN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\color{blue}{\left(\left(\mathsf{neg}\left(\ell\right)\right) \cdot \left(\mathsf{neg}\left(\ell\right)\right)\right)}}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot A}}} \]
      18. pow-prod-downN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\left({\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot {\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)} \cdot A}}} \]
      19. pow-prod-upN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)}} \cdot A}}} \]
      20. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\color{blue}{\frac{-1}{2}} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} \cdot A}}} \]
      21. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\left(\frac{-1}{2} + \color{blue}{\frac{-1}{2}}\right)} \cdot A}}} \]
      22. metadata-evalN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{{\left(\mathsf{neg}\left(\ell\right)\right)}^{\color{blue}{-1}} \cdot A}}} \]
      23. inv-powN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{1}{\mathsf{neg}\left(\ell\right)}} \cdot A}}} \]
      24. *-commutativeN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{A \cdot \frac{1}{\mathsf{neg}\left(\ell\right)}}}}} \]
      25. div-invN/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}}}} \]
      26. lift-/.f64N/A

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

      \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}} \]
    9. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\frac{V}{\color{blue}{\frac{A}{\ell}}}}} \]
      2. frac-2negN/A

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\mathsf{neg}\left(V\right)}{\mathsf{neg}\left(\frac{A}{\ell}\right)}}}} \]
      3. div-invN/A

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(V\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\frac{A}{\ell}\right)}}}} \]
      4. sqrt-prodN/A

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\frac{1}{\mathsf{neg}\left(\frac{A}{\ell}\right)}}}} \]
      5. distribute-frac-neg2N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\color{blue}{\mathsf{neg}\left(\frac{1}{\frac{A}{\ell}}\right)}}} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\mathsf{neg}\left(\frac{1}{\color{blue}{\frac{A}{\ell}}}\right)}} \]
      7. clear-numN/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\mathsf{neg}\left(\color{blue}{\frac{\ell}{A}}\right)}} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\mathsf{neg}\left(\frac{\ell}{A}\right)}}} \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\mathsf{neg}\left(V\right)}} \cdot \sqrt{\mathsf{neg}\left(\frac{\ell}{A}\right)}} \]
      10. lower-neg.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\mathsf{neg}\left(V\right)}} \cdot \sqrt{\mathsf{neg}\left(\frac{\ell}{A}\right)}} \]
      11. clear-numN/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{A}{\ell}}}\right)}} \]
      12. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\mathsf{neg}\left(\frac{1}{\color{blue}{\frac{A}{\ell}}}\right)}} \]
      13. distribute-frac-neg2N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\color{blue}{\frac{1}{\mathsf{neg}\left(\frac{A}{\ell}\right)}}}} \]
      14. lower-sqrt.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \color{blue}{\sqrt{\frac{1}{\mathsf{neg}\left(\frac{A}{\ell}\right)}}}} \]
      15. distribute-frac-neg2N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\color{blue}{\mathsf{neg}\left(\frac{1}{\frac{A}{\ell}}\right)}}} \]
      16. lift-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\mathsf{neg}\left(\frac{1}{\color{blue}{\frac{A}{\ell}}}\right)}} \]
      17. clear-numN/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\mathsf{neg}\left(\color{blue}{\frac{\ell}{A}}\right)}} \]
      18. distribute-neg-fracN/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(\ell\right)}{A}}}} \]
      19. lower-/.f64N/A

        \[\leadsto \frac{c0}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(\ell\right)}{A}}}} \]
      20. lower-neg.f6487.4

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

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

    if -4.999999999999985e-310 < V

    1. Initial program 75.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}} \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \ell}} \cdot \sqrt{A}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \ell}} \cdot \sqrt{A}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \ell}}} \cdot \sqrt{A} \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{V \cdot \ell}}} \cdot \sqrt{A} \]
      10. lower-sqrt.f6437.3

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

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

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{V} \cdot \sqrt{\ell}}} \cdot \sqrt{A} \]
      2. lift-sqrt.f64N/A

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{V}} \cdot \sqrt{\ell}} \cdot \sqrt{A} \]
      3. lift-sqrt.f64N/A

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

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

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

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

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

Alternative 12: 86.8% accurate, 0.6× speedup?

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

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


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

    1. Initial program 71.3%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      2. lower-/.f64N/A

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
      3. lower-/.f6475.0

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\mathsf{neg}\left(\frac{A}{\ell}\right)}{\mathsf{neg}\left(V\right)}}} \]
      3. sqrt-divN/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}}{\sqrt{\mathsf{neg}\left(V\right)}}} \]
      4. lower-/.f64N/A

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}}{\sqrt{\mathsf{neg}\left(V\right)}}} \]
      5. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\color{blue}{\sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      6. lift-/.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(\color{blue}{\frac{A}{\ell}}\right)}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      7. distribute-neg-frac2N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\color{blue}{\frac{A}{\mathsf{neg}\left(\ell\right)}}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      9. lower-neg.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\frac{A}{\color{blue}{\mathsf{neg}\left(\ell\right)}}}}{\sqrt{\mathsf{neg}\left(V\right)}} \]
      10. lower-sqrt.f64N/A

        \[\leadsto c0 \cdot \frac{\sqrt{\frac{A}{\mathsf{neg}\left(\ell\right)}}}{\color{blue}{\sqrt{\mathsf{neg}\left(V\right)}}} \]
      11. lower-neg.f6487.0

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

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

    if -4.999999999999985e-310 < V

    1. Initial program 75.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}} \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \ell}} \cdot \sqrt{A}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \ell}} \cdot \sqrt{A}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \ell}}} \cdot \sqrt{A} \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{V \cdot \ell}}} \cdot \sqrt{A} \]
      10. lower-sqrt.f6437.3

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

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

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{V} \cdot \sqrt{\ell}}} \cdot \sqrt{A} \]
      2. lift-sqrt.f64N/A

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{V}} \cdot \sqrt{\ell}} \cdot \sqrt{A} \]
      3. lift-sqrt.f64N/A

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

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

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

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

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

Alternative 13: 74.2% accurate, 1.0× speedup?

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

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

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

Reproduce

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