Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.7% → 89.7%
Time: 7.2s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 73.7% accurate, 1.0× speedup?

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

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

Alternative 1: 89.7% accurate, 0.4× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{-76}:\\ \;\;\;\;\frac{\sqrt{-A} \cdot c0}{\sqrt{\ell} \cdot \sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-310}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+307}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-1}{-\ell} \cdot \frac{A}{V}} \cdot c0\\ \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 l) -5e-76)
   (/ (* (sqrt (- A)) c0) (* (sqrt l) (sqrt (- V))))
   (if (<= (* V l) 1e-310)
     (/ c0 (* (sqrt (/ V A)) (sqrt l)))
     (if (<= (* V l) 4e+307)
       (/ c0 (/ (sqrt (* V l)) (sqrt A)))
       (* (sqrt (* (/ -1.0 (- l)) (/ A V))) c0)))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -5e-76) {
		tmp = (sqrt(-A) * c0) / (sqrt(l) * sqrt(-V));
	} else if ((V * l) <= 1e-310) {
		tmp = c0 / (sqrt((V / A)) * sqrt(l));
	} else if ((V * l) <= 4e+307) {
		tmp = c0 / (sqrt((V * l)) / sqrt(A));
	} else {
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	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 * l) <= (-5d-76)) then
        tmp = (sqrt(-a) * c0) / (sqrt(l) * sqrt(-v))
    else if ((v * l) <= 1d-310) then
        tmp = c0 / (sqrt((v / a)) * sqrt(l))
    else if ((v * l) <= 4d+307) then
        tmp = c0 / (sqrt((v * l)) / sqrt(a))
    else
        tmp = sqrt((((-1.0d0) / -l) * (a / v))) * c0
    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 * l) <= -5e-76) {
		tmp = (Math.sqrt(-A) * c0) / (Math.sqrt(l) * Math.sqrt(-V));
	} else if ((V * l) <= 1e-310) {
		tmp = c0 / (Math.sqrt((V / A)) * Math.sqrt(l));
	} else if ((V * l) <= 4e+307) {
		tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
	} else {
		tmp = Math.sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -5e-76:
		tmp = (math.sqrt(-A) * c0) / (math.sqrt(l) * math.sqrt(-V))
	elif (V * l) <= 1e-310:
		tmp = c0 / (math.sqrt((V / A)) * math.sqrt(l))
	elif (V * l) <= 4e+307:
		tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A))
	else:
		tmp = math.sqrt(((-1.0 / -l) * (A / V))) * c0
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= -5e-76)
		tmp = Float64(Float64(sqrt(Float64(-A)) * c0) / Float64(sqrt(l) * sqrt(Float64(-V))));
	elseif (Float64(V * l) <= 1e-310)
		tmp = Float64(c0 / Float64(sqrt(Float64(V / A)) * sqrt(l)));
	elseif (Float64(V * l) <= 4e+307)
		tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A)));
	else
		tmp = Float64(sqrt(Float64(Float64(-1.0 / Float64(-l)) * Float64(A / V))) * c0);
	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 * l) <= -5e-76)
		tmp = (sqrt(-A) * c0) / (sqrt(l) * sqrt(-V));
	elseif ((V * l) <= 1e-310)
		tmp = c0 / (sqrt((V / A)) * sqrt(l));
	elseif ((V * l) <= 4e+307)
		tmp = c0 / (sqrt((V * l)) / sqrt(A));
	else
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	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[(V * l), $MachinePrecision], -5e-76], N[(N[(N[Sqrt[(-A)], $MachinePrecision] * c0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e-310], N[(c0 / N[(N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+307], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(-1.0 / (-l)), $MachinePrecision] * N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{-76}:\\
\;\;\;\;\frac{\sqrt{-A} \cdot c0}{\sqrt{\ell} \cdot \sqrt{-V}}\\

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

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

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


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

    1. Initial program 80.2%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-divN/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-*r/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-*r/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. frac-2negN/A

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

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

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

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

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

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

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

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

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

    if -4.9999999999999998e-76 < (*.f64 V l) < 9.999999999999969e-311

    1. Initial program 64.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{\color{blue}{\frac{A}{V \cdot \ell}}} \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-divN/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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{\color{blue}{{\left(\frac{V}{A}\right)}^{\frac{1}{2}} \cdot {\ell}^{\frac{1}{2}}}} \]
      9. pow1/2N/A

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\frac{V}{A}}} \cdot {\ell}^{\frac{1}{2}}} \]
      10. pow1/2N/A

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

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

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

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

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

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

    if 9.999999999999969e-311 < (*.f64 V l) < 3.99999999999999994e307

    1. Initial program 85.3%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-divN/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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999994e307 < (*.f64 V l)

    1. Initial program 32.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.0% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 44.2%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

    if 1.00000023e-317 < (/.f64 A (*.f64 V l)) < 1.9999999999999999e291

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{\sqrt{\frac{\color{blue}{\ell \cdot V}}{A}}} \]
      13. lower-*.f6499.6

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

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

    if 1.9999999999999999e291 < (/.f64 A (*.f64 V l))

    1. Initial program 41.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{\color{blue}{\frac{A}{V \cdot \ell}}} \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-divN/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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 80.3% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 44.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

    if 0.0 < (/.f64 A (*.f64 V l)) < 1.9999999999999999e291

    1. Initial program 99.1%

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

    if 1.9999999999999999e291 < (/.f64 A (*.f64 V l))

    1. Initial program 41.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{\color{blue}{\frac{A}{V \cdot \ell}}} \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-divN/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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 79.7% accurate, 0.4× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ t_1 := \sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 1.7 \cdot 10^{+273}:\\ \;\;\;\;\sqrt{t\_0} \cdot c0\\ \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 (/ A (* V l))) (t_1 (* (sqrt (/ (/ A V) l)) c0)))
   (if (<= t_0 0.0) t_1 (if (<= t_0 1.7e+273) (* (sqrt t_0) c0) t_1))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = A / (V * l);
	double t_1 = sqrt(((A / V) / l)) * c0;
	double tmp;
	if (t_0 <= 0.0) {
		tmp = t_1;
	} else if (t_0 <= 1.7e+273) {
		tmp = sqrt(t_0) * c0;
	} 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 = a / (v * l)
    t_1 = sqrt(((a / v) / l)) * c0
    if (t_0 <= 0.0d0) then
        tmp = t_1
    else if (t_0 <= 1.7d+273) then
        tmp = sqrt(t_0) * c0
    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 = A / (V * l);
	double t_1 = Math.sqrt(((A / V) / l)) * c0;
	double tmp;
	if (t_0 <= 0.0) {
		tmp = t_1;
	} else if (t_0 <= 1.7e+273) {
		tmp = Math.sqrt(t_0) * c0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	t_0 = A / (V * l)
	t_1 = math.sqrt(((A / V) / l)) * c0
	tmp = 0
	if t_0 <= 0.0:
		tmp = t_1
	elif t_0 <= 1.7e+273:
		tmp = math.sqrt(t_0) * c0
	else:
		tmp = t_1
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	t_0 = Float64(A / Float64(V * l))
	t_1 = Float64(sqrt(Float64(Float64(A / V) / l)) * c0)
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = t_1;
	elseif (t_0 <= 1.7e+273)
		tmp = Float64(sqrt(t_0) * c0);
	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 = A / (V * l);
	t_1 = sqrt(((A / V) / l)) * c0;
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = t_1;
	elseif (t_0 <= 1.7e+273)
		tmp = sqrt(t_0) * c0;
	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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 1.7e+273], N[(N[Sqrt[t$95$0], $MachinePrecision] * c0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
t_1 := \sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\

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

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


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

    1. Initial program 45.0%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

    if 0.0 < (/.f64 A (*.f64 V l)) < 1.69999999999999999e273

    1. Initial program 99.1%

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

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

Alternative 5: 89.0% accurate, 0.4× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-306}:\\ \;\;\;\;\frac{\sqrt{-A}}{\sqrt{\left(-\ell\right) \cdot V}} \cdot c0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-310}:\\ \;\;\;\;\sqrt{\frac{\frac{A}{\ell}}{V}} \cdot c0\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+307}:\\ \;\;\;\;\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-1}{-\ell} \cdot \frac{A}{V}} \cdot c0\\ \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 l) -1e-306)
   (* (/ (sqrt (- A)) (sqrt (* (- l) V))) c0)
   (if (<= (* V l) 1e-310)
     (* (sqrt (/ (/ A l) V)) c0)
     (if (<= (* V l) 4e+307)
       (* (/ (sqrt A) (sqrt (* V l))) c0)
       (* (sqrt (* (/ -1.0 (- l)) (/ A V))) c0)))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -1e-306) {
		tmp = (sqrt(-A) / sqrt((-l * V))) * c0;
	} else if ((V * l) <= 1e-310) {
		tmp = sqrt(((A / l) / V)) * c0;
	} else if ((V * l) <= 4e+307) {
		tmp = (sqrt(A) / sqrt((V * l))) * c0;
	} else {
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	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 * l) <= (-1d-306)) then
        tmp = (sqrt(-a) / sqrt((-l * v))) * c0
    else if ((v * l) <= 1d-310) then
        tmp = sqrt(((a / l) / v)) * c0
    else if ((v * l) <= 4d+307) then
        tmp = (sqrt(a) / sqrt((v * l))) * c0
    else
        tmp = sqrt((((-1.0d0) / -l) * (a / v))) * c0
    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 * l) <= -1e-306) {
		tmp = (Math.sqrt(-A) / Math.sqrt((-l * V))) * c0;
	} else if ((V * l) <= 1e-310) {
		tmp = Math.sqrt(((A / l) / V)) * c0;
	} else if ((V * l) <= 4e+307) {
		tmp = (Math.sqrt(A) / Math.sqrt((V * l))) * c0;
	} else {
		tmp = Math.sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -1e-306:
		tmp = (math.sqrt(-A) / math.sqrt((-l * V))) * c0
	elif (V * l) <= 1e-310:
		tmp = math.sqrt(((A / l) / V)) * c0
	elif (V * l) <= 4e+307:
		tmp = (math.sqrt(A) / math.sqrt((V * l))) * c0
	else:
		tmp = math.sqrt(((-1.0 / -l) * (A / V))) * c0
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= -1e-306)
		tmp = Float64(Float64(sqrt(Float64(-A)) / sqrt(Float64(Float64(-l) * V))) * c0);
	elseif (Float64(V * l) <= 1e-310)
		tmp = Float64(sqrt(Float64(Float64(A / l) / V)) * c0);
	elseif (Float64(V * l) <= 4e+307)
		tmp = Float64(Float64(sqrt(A) / sqrt(Float64(V * l))) * c0);
	else
		tmp = Float64(sqrt(Float64(Float64(-1.0 / Float64(-l)) * Float64(A / V))) * c0);
	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 * l) <= -1e-306)
		tmp = (sqrt(-A) / sqrt((-l * V))) * c0;
	elseif ((V * l) <= 1e-310)
		tmp = sqrt(((A / l) / V)) * c0;
	elseif ((V * l) <= 4e+307)
		tmp = (sqrt(A) / sqrt((V * l))) * c0;
	else
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	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[(V * l), $MachinePrecision], -1e-306], N[(N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[((-l) * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e-310], N[(N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+307], N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], N[(N[Sqrt[N[(N[(-1.0 / (-l)), $MachinePrecision] * N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-306}:\\
\;\;\;\;\frac{\sqrt{-A}}{\sqrt{\left(-\ell\right) \cdot V}} \cdot c0\\

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

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

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


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

    1. Initial program 81.2%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000003e-306 < (*.f64 V l) < 9.999999999999969e-311

    1. Initial program 47.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/l/N/A

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

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

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

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

    if 9.999999999999969e-311 < (*.f64 V l) < 3.99999999999999994e307

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{\sqrt{A}}{\sqrt{\color{blue}{\ell \cdot V}}} \]
      9. lower-*.f6499.4

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

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

    if 3.99999999999999994e307 < (*.f64 V l)

    1. Initial program 32.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.8% accurate, 0.5× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq 10^{-310}:\\ \;\;\;\;\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}} \cdot c0\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+307}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-1}{-\ell} \cdot \frac{A}{V}} \cdot c0\\ \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 l) 1e-310)
   (* (/ (sqrt (/ A V)) (sqrt l)) c0)
   (if (<= (* V l) 4e+307)
     (/ c0 (/ (sqrt (* V l)) (sqrt A)))
     (* (sqrt (* (/ -1.0 (- l)) (/ A V))) c0))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= 1e-310) {
		tmp = (sqrt((A / V)) / sqrt(l)) * c0;
	} else if ((V * l) <= 4e+307) {
		tmp = c0 / (sqrt((V * l)) / sqrt(A));
	} else {
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	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 * l) <= 1d-310) then
        tmp = (sqrt((a / v)) / sqrt(l)) * c0
    else if ((v * l) <= 4d+307) then
        tmp = c0 / (sqrt((v * l)) / sqrt(a))
    else
        tmp = sqrt((((-1.0d0) / -l) * (a / v))) * c0
    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 * l) <= 1e-310) {
		tmp = (Math.sqrt((A / V)) / Math.sqrt(l)) * c0;
	} else if ((V * l) <= 4e+307) {
		tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
	} else {
		tmp = Math.sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= 1e-310:
		tmp = (math.sqrt((A / V)) / math.sqrt(l)) * c0
	elif (V * l) <= 4e+307:
		tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A))
	else:
		tmp = math.sqrt(((-1.0 / -l) * (A / V))) * c0
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= 1e-310)
		tmp = Float64(Float64(sqrt(Float64(A / V)) / sqrt(l)) * c0);
	elseif (Float64(V * l) <= 4e+307)
		tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A)));
	else
		tmp = Float64(sqrt(Float64(Float64(-1.0 / Float64(-l)) * Float64(A / V))) * c0);
	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 * l) <= 1e-310)
		tmp = (sqrt((A / V)) / sqrt(l)) * c0;
	elseif ((V * l) <= 4e+307)
		tmp = c0 / (sqrt((V * l)) / sqrt(A));
	else
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	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[(V * l), $MachinePrecision], 1e-310], N[(N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+307], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(-1.0 / (-l)), $MachinePrecision] * N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq 10^{-310}:\\
\;\;\;\;\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}} \cdot c0\\

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

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


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

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

    if 9.999999999999969e-311 < (*.f64 V l) < 3.99999999999999994e307

    1. Initial program 85.3%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      4. sqrt-divN/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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999994e307 < (*.f64 V l)

    1. Initial program 32.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 86.1% accurate, 0.5× speedup?

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

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


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

    1. Initial program 74.2%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{{A}^{\frac{1}{2}}} \cdot \frac{c0}{\sqrt{V}}}{\sqrt{-\ell}} \]
      17. pow1/2N/A

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

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

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

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

    if -4.999999999999985e-310 < l

    1. Initial program 76.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 85.8% accurate, 0.5× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq 10^{-310}:\\ \;\;\;\;\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}} \cdot c0\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+307}:\\ \;\;\;\;\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-1}{-\ell} \cdot \frac{A}{V}} \cdot c0\\ \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 l) 1e-310)
   (* (/ (sqrt (/ A V)) (sqrt l)) c0)
   (if (<= (* V l) 4e+307)
     (* (/ (sqrt A) (sqrt (* V l))) c0)
     (* (sqrt (* (/ -1.0 (- l)) (/ A V))) c0))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= 1e-310) {
		tmp = (sqrt((A / V)) / sqrt(l)) * c0;
	} else if ((V * l) <= 4e+307) {
		tmp = (sqrt(A) / sqrt((V * l))) * c0;
	} else {
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	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 * l) <= 1d-310) then
        tmp = (sqrt((a / v)) / sqrt(l)) * c0
    else if ((v * l) <= 4d+307) then
        tmp = (sqrt(a) / sqrt((v * l))) * c0
    else
        tmp = sqrt((((-1.0d0) / -l) * (a / v))) * c0
    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 * l) <= 1e-310) {
		tmp = (Math.sqrt((A / V)) / Math.sqrt(l)) * c0;
	} else if ((V * l) <= 4e+307) {
		tmp = (Math.sqrt(A) / Math.sqrt((V * l))) * c0;
	} else {
		tmp = Math.sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= 1e-310:
		tmp = (math.sqrt((A / V)) / math.sqrt(l)) * c0
	elif (V * l) <= 4e+307:
		tmp = (math.sqrt(A) / math.sqrt((V * l))) * c0
	else:
		tmp = math.sqrt(((-1.0 / -l) * (A / V))) * c0
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= 1e-310)
		tmp = Float64(Float64(sqrt(Float64(A / V)) / sqrt(l)) * c0);
	elseif (Float64(V * l) <= 4e+307)
		tmp = Float64(Float64(sqrt(A) / sqrt(Float64(V * l))) * c0);
	else
		tmp = Float64(sqrt(Float64(Float64(-1.0 / Float64(-l)) * Float64(A / V))) * c0);
	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 * l) <= 1e-310)
		tmp = (sqrt((A / V)) / sqrt(l)) * c0;
	elseif ((V * l) <= 4e+307)
		tmp = (sqrt(A) / sqrt((V * l))) * c0;
	else
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	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[(V * l), $MachinePrecision], 1e-310], N[(N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+307], N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], N[(N[Sqrt[N[(N[(-1.0 / (-l)), $MachinePrecision] * N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq 10^{-310}:\\
\;\;\;\;\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}} \cdot c0\\

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

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


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

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

    if 9.999999999999969e-311 < (*.f64 V l) < 3.99999999999999994e307

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{\sqrt{A}}{\sqrt{\color{blue}{\ell \cdot V}}} \]
      9. lower-*.f6499.4

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

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

    if 3.99999999999999994e307 < (*.f64 V l)

    1. Initial program 32.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 82.3% accurate, 0.5× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq 10^{-310}:\\ \;\;\;\;\sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+307}:\\ \;\;\;\;\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-1}{-\ell} \cdot \frac{A}{V}} \cdot c0\\ \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 l) 1e-310)
   (* (sqrt (/ (/ A V) l)) c0)
   (if (<= (* V l) 4e+307)
     (* (/ (sqrt A) (sqrt (* V l))) c0)
     (* (sqrt (* (/ -1.0 (- l)) (/ A V))) c0))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= 1e-310) {
		tmp = sqrt(((A / V) / l)) * c0;
	} else if ((V * l) <= 4e+307) {
		tmp = (sqrt(A) / sqrt((V * l))) * c0;
	} else {
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	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 * l) <= 1d-310) then
        tmp = sqrt(((a / v) / l)) * c0
    else if ((v * l) <= 4d+307) then
        tmp = (sqrt(a) / sqrt((v * l))) * c0
    else
        tmp = sqrt((((-1.0d0) / -l) * (a / v))) * c0
    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 * l) <= 1e-310) {
		tmp = Math.sqrt(((A / V) / l)) * c0;
	} else if ((V * l) <= 4e+307) {
		tmp = (Math.sqrt(A) / Math.sqrt((V * l))) * c0;
	} else {
		tmp = Math.sqrt(((-1.0 / -l) * (A / V))) * c0;
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= 1e-310:
		tmp = math.sqrt(((A / V) / l)) * c0
	elif (V * l) <= 4e+307:
		tmp = (math.sqrt(A) / math.sqrt((V * l))) * c0
	else:
		tmp = math.sqrt(((-1.0 / -l) * (A / V))) * c0
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= 1e-310)
		tmp = Float64(sqrt(Float64(Float64(A / V) / l)) * c0);
	elseif (Float64(V * l) <= 4e+307)
		tmp = Float64(Float64(sqrt(A) / sqrt(Float64(V * l))) * c0);
	else
		tmp = Float64(sqrt(Float64(Float64(-1.0 / Float64(-l)) * Float64(A / V))) * c0);
	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 * l) <= 1e-310)
		tmp = sqrt(((A / V) / l)) * c0;
	elseif ((V * l) <= 4e+307)
		tmp = (sqrt(A) / sqrt((V * l))) * c0;
	else
		tmp = sqrt(((-1.0 / -l) * (A / V))) * c0;
	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[(V * l), $MachinePrecision], 1e-310], N[(N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+307], N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], N[(N[Sqrt[N[(N[(-1.0 / (-l)), $MachinePrecision] * N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq 10^{-310}:\\
\;\;\;\;\sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\

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

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


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

    1. Initial program 73.2%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

    if 9.999999999999969e-311 < (*.f64 V l) < 3.99999999999999994e307

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{\sqrt{A}}{\sqrt{\color{blue}{\ell \cdot V}}} \]
      9. lower-*.f6499.4

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

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

    if 3.99999999999999994e307 < (*.f64 V l)

    1. Initial program 32.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 82.3% accurate, 0.5× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\ \mathbf{if}\;V \cdot \ell \leq 10^{-310}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+307}:\\ \;\;\;\;\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0\\ \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 (* (sqrt (/ (/ A V) l)) c0)))
   (if (<= (* V l) 1e-310)
     t_0
     (if (<= (* V l) 4e+307) (* (/ (sqrt A) (sqrt (* V l))) c0) t_0))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double t_0 = sqrt(((A / V) / l)) * c0;
	double tmp;
	if ((V * l) <= 1e-310) {
		tmp = t_0;
	} else if ((V * l) <= 4e+307) {
		tmp = (sqrt(A) / sqrt((V * l))) * c0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((a / v) / l)) * c0
    if ((v * l) <= 1d-310) then
        tmp = t_0
    else if ((v * l) <= 4d+307) then
        tmp = (sqrt(a) / sqrt((v * l))) * c0
    else
        tmp = t_0
    end if
    code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = Math.sqrt(((A / V) / l)) * c0;
	double tmp;
	if ((V * l) <= 1e-310) {
		tmp = t_0;
	} else if ((V * l) <= 4e+307) {
		tmp = (Math.sqrt(A) / Math.sqrt((V * l))) * c0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	t_0 = math.sqrt(((A / V) / l)) * c0
	tmp = 0
	if (V * l) <= 1e-310:
		tmp = t_0
	elif (V * l) <= 4e+307:
		tmp = (math.sqrt(A) / math.sqrt((V * l))) * c0
	else:
		tmp = t_0
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	t_0 = Float64(sqrt(Float64(Float64(A / V) / l)) * c0)
	tmp = 0.0
	if (Float64(V * l) <= 1e-310)
		tmp = t_0;
	elseif (Float64(V * l) <= 4e+307)
		tmp = Float64(Float64(sqrt(A) / sqrt(Float64(V * l))) * c0);
	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 = sqrt(((A / V) / l)) * c0;
	tmp = 0.0;
	if ((V * l) <= 1e-310)
		tmp = t_0;
	elseif ((V * l) <= 4e+307)
		tmp = (sqrt(A) / sqrt((V * l))) * c0;
	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[(N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], 1e-310], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 4e+307], N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\
\mathbf{if}\;V \cdot \ell \leq 10^{-310}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 V l) < 9.999999999999969e-311 or 3.99999999999999994e307 < (*.f64 V l)

    1. Initial program 68.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/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. associate-/r*N/A

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

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

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

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

    if 9.999999999999969e-311 < (*.f64 V l) < 3.99999999999999994e307

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{\sqrt{A}}{\sqrt{\color{blue}{\ell \cdot V}}} \]
      9. lower-*.f6499.4

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

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

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

Alternative 11: 73.7% accurate, 1.0× speedup?

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

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

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

Reproduce

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