Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.4% → 91.4%
Time: 6.5s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 74.4% accurate, 1.0× speedup?

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

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

Alternative 1: 91.4% accurate, 0.1× speedup?

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{{\left(\ell \cdot V\right)}^{-0.5}}{{A}^{-0.5}}\\


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

    1. Initial program 72.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-/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-/.f6472.7

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

      \[\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-sqrt.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < A

    1. Initial program 74.1%

      \[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. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{\frac{{\left(\ell \cdot V\right)}^{-0.5}}{{A}^{-0.5}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification70.5%

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

Alternative 2: 77.0% accurate, 0.3× speedup?

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

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


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

    1. Initial program 64.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-/.f6470.4

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

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

    if 3.99999999999999977e-252 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1e288

    1. Initial program 98.4%

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

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

Alternative 3: 77.2% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 65.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-/.f6471.2

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

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

    if 3.99999999999999977e-252 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 3.9999999999999998e291

    1. Initial program 98.4%

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

    if 3.9999999999999998e291 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 55.3%

      \[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-/.f6455.3

        \[\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-*.f6455.3

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

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

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

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

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

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

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

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

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

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

Alternative 4: 77.0% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 65.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-/.f6471.2

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

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

    if 3.99999999999999977e-252 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 3.9999999999999998e291

    1. Initial program 98.4%

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

    if 3.9999999999999998e291 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 55.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-/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-/.f6464.9

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

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

Alternative 5: 90.3% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-316} \lor \neg \left(V \cdot \ell \leq 10^{+262}\right):\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\

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


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

    1. Initial program 37.7%

      \[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-/.f6437.7

        \[\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-*.f6437.7

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -4.99999999982e-314

    1. Initial program 85.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-/.f6474.8

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

      \[\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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999982e-314 < (*.f64 V l) < 2.000000017e-316 or 1e262 < (*.f64 V l)

    1. Initial program 44.9%

      \[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-/.f6444.9

        \[\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-*.f6444.9

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

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

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

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

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

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

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

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

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

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

    if 2.000000017e-316 < (*.f64 V l) < 1e262

    1. Initial program 83.5%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 89.8% accurate, 0.3× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-277}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\left(-V\right) \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+262}:\\ \;\;\;\;\left(\frac{--1}{\sqrt{V \cdot \ell}} \cdot c0\right) \cdot \sqrt{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 (* c0 (/ (sqrt (/ (- A) l)) (sqrt (- V))))))
   (if (<= (* V l) (- INFINITY))
     t_0
     (if (<= (* V l) -5e-277)
       (* c0 (/ (sqrt (- A)) (sqrt (* (- V) l))))
       (if (<= (* V l) 0.0)
         t_0
         (if (<= (* V l) 1e+262)
           (* (* (/ (- -1.0) (sqrt (* V l))) c0) (sqrt 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 = c0 * (sqrt((-A / l)) / sqrt(-V));
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = t_0;
	} else if ((V * l) <= -5e-277) {
		tmp = c0 * (sqrt(-A) / sqrt((-V * l)));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else if ((V * l) <= 1e+262) {
		tmp = ((-(-1.0) / sqrt((V * l))) * c0) * sqrt(A);
	} else {
		tmp = c0 / sqrt(((l / A) * V));
	}
	return tmp;
}
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	double t_0 = c0 * (Math.sqrt((-A / l)) / Math.sqrt(-V));
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = t_0;
	} else if ((V * l) <= -5e-277) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((-V * l)));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else if ((V * l) <= 1e+262) {
		tmp = ((-(-1.0) / Math.sqrt((V * l))) * c0) * Math.sqrt(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 = c0 * (math.sqrt((-A / l)) / math.sqrt(-V))
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = t_0
	elif (V * l) <= -5e-277:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((-V * l)))
	elif (V * l) <= 0.0:
		tmp = t_0
	elif (V * l) <= 1e+262:
		tmp = ((-(-1.0) / math.sqrt((V * l))) * c0) * math.sqrt(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(c0 * Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V))))
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = t_0;
	elseif (Float64(V * l) <= -5e-277)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(Float64(-V) * l))));
	elseif (Float64(V * l) <= 0.0)
		tmp = t_0;
	elseif (Float64(V * l) <= 1e+262)
		tmp = Float64(Float64(Float64(Float64(-(-1.0)) / sqrt(Float64(V * l))) * c0) * sqrt(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 = c0 * (sqrt((-A / l)) / sqrt(-V));
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = t_0;
	elseif ((V * l) <= -5e-277)
		tmp = c0 * (sqrt(-A) / sqrt((-V * l)));
	elseif ((V * l) <= 0.0)
		tmp = t_0;
	elseif ((V * l) <= 1e+262)
		tmp = ((-(-1.0) / sqrt((V * l))) * c0) * sqrt(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[(c0 * N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -5e-277], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[((-V) * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 1e+262], N[(N[(N[((--1.0) / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * N[Sqrt[A], $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 := c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;t\_0\\

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

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


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

    1. Initial program 42.9%

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

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

      \[\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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -5e-277

    1. Initial program 85.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-/.f6475.0

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

      \[\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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 82.9%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e262 < (*.f64 V l)

    1. Initial program 46.1%

      \[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-/.f6446.1

        \[\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-*.f6446.1

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 90.3% 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 -\infty:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-314}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\left(-V\right) \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-316} \lor \neg \left(V \cdot \ell \leq 10^{+262}\right):\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot V}} \cdot \sqrt{A}\\ \end{array} \end{array} \]
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) (- INFINITY))
   (/ c0 (* (sqrt (/ V A)) (sqrt l)))
   (if (<= (* V l) -5e-314)
     (* c0 (/ (sqrt (- A)) (sqrt (* (- V) l))))
     (if (or (<= (* V l) 2e-316) (not (<= (* V l) 1e+262)))
       (/ c0 (sqrt (* (/ l A) V)))
       (* (/ c0 (sqrt (* l V))) (sqrt A))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 / (sqrt((V / A)) * sqrt(l));
	} else if ((V * l) <= -5e-314) {
		tmp = c0 * (sqrt(-A) / sqrt((-V * l)));
	} else if (((V * l) <= 2e-316) || !((V * l) <= 1e+262)) {
		tmp = c0 / sqrt(((l / A) * V));
	} else {
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	}
	return tmp;
}
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = c0 / (Math.sqrt((V / A)) * Math.sqrt(l));
	} else if ((V * l) <= -5e-314) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((-V * l)));
	} else if (((V * l) <= 2e-316) || !((V * l) <= 1e+262)) {
		tmp = c0 / Math.sqrt(((l / A) * V));
	} else {
		tmp = (c0 / Math.sqrt((l * V))) * Math.sqrt(A);
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = c0 / (math.sqrt((V / A)) * math.sqrt(l))
	elif (V * l) <= -5e-314:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((-V * l)))
	elif ((V * l) <= 2e-316) or not ((V * l) <= 1e+262):
		tmp = c0 / math.sqrt(((l / A) * V))
	else:
		tmp = (c0 / math.sqrt((l * V))) * math.sqrt(A)
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = Float64(c0 / Float64(sqrt(Float64(V / A)) * sqrt(l)));
	elseif (Float64(V * l) <= -5e-314)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(Float64(-V) * l))));
	elseif ((Float64(V * l) <= 2e-316) || !(Float64(V * l) <= 1e+262))
		tmp = Float64(c0 / sqrt(Float64(Float64(l / A) * V)));
	else
		tmp = Float64(Float64(c0 / sqrt(Float64(l * V))) * sqrt(A));
	end
	return tmp
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = c0 / (sqrt((V / A)) * sqrt(l));
	elseif ((V * l) <= -5e-314)
		tmp = c0 * (sqrt(-A) / sqrt((-V * l)));
	elseif (((V * l) <= 2e-316) || ~(((V * l) <= 1e+262)))
		tmp = c0 / sqrt(((l / A) * V));
	else
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	end
	tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 / N[(N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-314], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[((-V) * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(V * l), $MachinePrecision], 2e-316], N[Not[LessEqual[N[(V * l), $MachinePrecision], 1e+262]], $MachinePrecision]], N[(c0 / N[Sqrt[N[(N[(l / A), $MachinePrecision] * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}\\

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

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-316} \lor \neg \left(V \cdot \ell \leq 10^{+262}\right):\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\

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


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

    1. Initial program 37.7%

      \[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-/.f6437.7

        \[\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-*.f6437.7

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -4.99999999982e-314

    1. Initial program 85.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-/.f6474.8

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

      \[\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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999982e-314 < (*.f64 V l) < 2.000000017e-316 or 1e262 < (*.f64 V l)

    1. Initial program 44.9%

      \[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-/.f6444.9

        \[\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-*.f6444.9

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

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

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

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

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

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

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

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

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

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

    if 2.000000017e-316 < (*.f64 V l) < 1e262

    1. Initial program 83.5%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 90.3% 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 -\infty:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-314}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\left(-V\right) \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-316} \lor \neg \left(V \cdot \ell \leq 10^{+262}\right):\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot V}} \cdot \sqrt{A}\\ \end{array} \end{array} \]
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) (- INFINITY))
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (if (<= (* V l) -5e-314)
     (* c0 (/ (sqrt (- A)) (sqrt (* (- V) l))))
     (if (or (<= (* V l) 2e-316) (not (<= (* V l) 1e+262)))
       (/ c0 (sqrt (* (/ l A) V)))
       (* (/ c0 (sqrt (* l V))) (sqrt A))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else if ((V * l) <= -5e-314) {
		tmp = c0 * (sqrt(-A) / sqrt((-V * l)));
	} else if (((V * l) <= 2e-316) || !((V * l) <= 1e+262)) {
		tmp = c0 / sqrt(((l / A) * V));
	} else {
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	}
	return tmp;
}
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else if ((V * l) <= -5e-314) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((-V * l)));
	} else if (((V * l) <= 2e-316) || !((V * l) <= 1e+262)) {
		tmp = c0 / Math.sqrt(((l / A) * V));
	} else {
		tmp = (c0 / Math.sqrt((l * V))) * Math.sqrt(A);
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	elif (V * l) <= -5e-314:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((-V * l)))
	elif ((V * l) <= 2e-316) or not ((V * l) <= 1e+262):
		tmp = c0 / math.sqrt(((l / A) * V))
	else:
		tmp = (c0 / math.sqrt((l * V))) * math.sqrt(A)
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	elseif (Float64(V * l) <= -5e-314)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(Float64(-V) * l))));
	elseif ((Float64(V * l) <= 2e-316) || !(Float64(V * l) <= 1e+262))
		tmp = Float64(c0 / sqrt(Float64(Float64(l / A) * V)));
	else
		tmp = Float64(Float64(c0 / sqrt(Float64(l * V))) * sqrt(A));
	end
	return tmp
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	elseif ((V * l) <= -5e-314)
		tmp = c0 * (sqrt(-A) / sqrt((-V * l)));
	elseif (((V * l) <= 2e-316) || ~(((V * l) <= 1e+262)))
		tmp = c0 / sqrt(((l / A) * V));
	else
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	end
	tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-314], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[((-V) * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(V * l), $MachinePrecision], 2e-316], N[Not[LessEqual[N[(V * l), $MachinePrecision], 1e+262]], $MachinePrecision]], N[(c0 / N[Sqrt[N[(N[(l / A), $MachinePrecision] * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

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

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-316} \lor \neg \left(V \cdot \ell \leq 10^{+262}\right):\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\

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


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

    1. Initial program 37.7%

      \[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.f6458.4

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

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

    if -inf.0 < (*.f64 V l) < -4.99999999982e-314

    1. Initial program 85.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-/.f6474.8

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

      \[\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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999982e-314 < (*.f64 V l) < 2.000000017e-316 or 1e262 < (*.f64 V l)

    1. Initial program 44.9%

      \[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-/.f6444.9

        \[\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-*.f6444.9

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

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

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

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

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

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

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

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

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

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

    if 2.000000017e-316 < (*.f64 V l) < 1e262

    1. Initial program 83.5%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 88.9% 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 -\infty:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-314}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\left(-V\right) \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-316} \lor \neg \left(V \cdot \ell \leq 10^{+262}\right):\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot V}} \cdot \sqrt{A}\\ \end{array} \end{array} \]
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) (- INFINITY))
   (/ c0 (sqrt (/ V (/ A l))))
   (if (<= (* V l) -5e-314)
     (* c0 (/ (sqrt (- A)) (sqrt (* (- V) l))))
     (if (or (<= (* V l) 2e-316) (not (<= (* V l) 1e+262)))
       (/ c0 (sqrt (* (/ l A) V)))
       (* (/ c0 (sqrt (* l V))) (sqrt A))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 / sqrt((V / (A / l)));
	} else if ((V * l) <= -5e-314) {
		tmp = c0 * (sqrt(-A) / sqrt((-V * l)));
	} else if (((V * l) <= 2e-316) || !((V * l) <= 1e+262)) {
		tmp = c0 / sqrt(((l / A) * V));
	} else {
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	}
	return tmp;
}
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = c0 / Math.sqrt((V / (A / l)));
	} else if ((V * l) <= -5e-314) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((-V * l)));
	} else if (((V * l) <= 2e-316) || !((V * l) <= 1e+262)) {
		tmp = c0 / Math.sqrt(((l / A) * V));
	} else {
		tmp = (c0 / Math.sqrt((l * V))) * Math.sqrt(A);
	}
	return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l])
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = c0 / math.sqrt((V / (A / l)))
	elif (V * l) <= -5e-314:
		tmp = c0 * (math.sqrt(-A) / math.sqrt((-V * l)))
	elif ((V * l) <= 2e-316) or not ((V * l) <= 1e+262):
		tmp = c0 / math.sqrt(((l / A) * V))
	else:
		tmp = (c0 / math.sqrt((l * V))) * math.sqrt(A)
	return tmp
c0, A, V, l = sort([c0, A, V, l])
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = Float64(c0 / sqrt(Float64(V / Float64(A / l))));
	elseif (Float64(V * l) <= -5e-314)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(Float64(-V) * l))));
	elseif ((Float64(V * l) <= 2e-316) || !(Float64(V * l) <= 1e+262))
		tmp = Float64(c0 / sqrt(Float64(Float64(l / A) * V)));
	else
		tmp = Float64(Float64(c0 / sqrt(Float64(l * V))) * sqrt(A));
	end
	return tmp
end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = c0 / sqrt((V / (A / l)));
	elseif ((V * l) <= -5e-314)
		tmp = c0 * (sqrt(-A) / sqrt((-V * l)));
	elseif (((V * l) <= 2e-316) || ~(((V * l) <= 1e+262)))
		tmp = c0 / sqrt(((l / A) * V));
	else
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	end
	tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-314], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[((-V) * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(V * l), $MachinePrecision], 2e-316], N[Not[LessEqual[N[(V * l), $MachinePrecision], 1e+262]], $MachinePrecision]], N[(c0 / N[Sqrt[N[(N[(l / A), $MachinePrecision] * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\

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

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-316} \lor \neg \left(V \cdot \ell \leq 10^{+262}\right):\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\

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


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

    1. Initial program 37.7%

      \[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-/.f6437.7

        \[\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-*.f6437.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -4.99999999982e-314

    1. Initial program 85.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-/.f6474.8

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

      \[\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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999982e-314 < (*.f64 V l) < 2.000000017e-316 or 1e262 < (*.f64 V l)

    1. Initial program 44.9%

      \[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-/.f6444.9

        \[\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-*.f6444.9

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

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

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

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

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

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

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

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

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

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

    if 2.000000017e-316 < (*.f64 V l) < 1e262

    1. Initial program 83.5%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-316} \lor \neg \left(V \cdot \ell \leq 10^{+262}\right):\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\

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


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

    1. Initial program 58.4%

      \[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-/.f6470.6

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

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

    if -1.99999999999999985e75 < (*.f64 V l) < -1.0000000000000001e-114

    1. Initial program 95.1%

      \[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-/.f6496.7

        \[\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-*.f6496.7

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

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

    if -1.0000000000000001e-114 < (*.f64 V l) < 2.000000017e-316 or 1e262 < (*.f64 V l)

    1. Initial program 60.1%

      \[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-/.f6460.2

        \[\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-*.f6460.2

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

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

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

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

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

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

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

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

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

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

    if 2.000000017e-316 < (*.f64 V l) < 1e262

    1. Initial program 83.5%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 82.9% 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 -2 \cdot 10^{+75}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-114}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell \cdot V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-316}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+262}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot V}} \cdot \sqrt{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
 (if (<= (* V l) -2e+75)
   (* c0 (sqrt (/ (/ A V) l)))
   (if (<= (* V l) -1e-114)
     (/ c0 (sqrt (/ (* l V) A)))
     (if (<= (* V l) 2e-316)
       (/ c0 (sqrt (/ V (/ A l))))
       (if (<= (* V l) 1e+262)
         (* (/ c0 (sqrt (* l V))) (sqrt A))
         (/ c0 (sqrt (* (/ l A) V))))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -2e+75) {
		tmp = c0 * sqrt(((A / V) / l));
	} else if ((V * l) <= -1e-114) {
		tmp = c0 / sqrt(((l * V) / A));
	} else if ((V * l) <= 2e-316) {
		tmp = c0 / sqrt((V / (A / l)));
	} else if ((V * l) <= 1e+262) {
		tmp = (c0 / sqrt((l * V))) * sqrt(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) :: tmp
    if ((v * l) <= (-2d+75)) then
        tmp = c0 * sqrt(((a / v) / l))
    else if ((v * l) <= (-1d-114)) then
        tmp = c0 / sqrt(((l * v) / a))
    else if ((v * l) <= 2d-316) then
        tmp = c0 / sqrt((v / (a / l)))
    else if ((v * l) <= 1d+262) then
        tmp = (c0 / sqrt((l * v))) * sqrt(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 tmp;
	if ((V * l) <= -2e+75) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else if ((V * l) <= -1e-114) {
		tmp = c0 / Math.sqrt(((l * V) / A));
	} else if ((V * l) <= 2e-316) {
		tmp = c0 / Math.sqrt((V / (A / l)));
	} else if ((V * l) <= 1e+262) {
		tmp = (c0 / Math.sqrt((l * V))) * Math.sqrt(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):
	tmp = 0
	if (V * l) <= -2e+75:
		tmp = c0 * math.sqrt(((A / V) / l))
	elif (V * l) <= -1e-114:
		tmp = c0 / math.sqrt(((l * V) / A))
	elif (V * l) <= 2e-316:
		tmp = c0 / math.sqrt((V / (A / l)))
	elif (V * l) <= 1e+262:
		tmp = (c0 / math.sqrt((l * V))) * math.sqrt(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)
	tmp = 0.0
	if (Float64(V * l) <= -2e+75)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	elseif (Float64(V * l) <= -1e-114)
		tmp = Float64(c0 / sqrt(Float64(Float64(l * V) / A)));
	elseif (Float64(V * l) <= 2e-316)
		tmp = Float64(c0 / sqrt(Float64(V / Float64(A / l))));
	elseif (Float64(V * l) <= 1e+262)
		tmp = Float64(Float64(c0 / sqrt(Float64(l * V))) * sqrt(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)
	tmp = 0.0;
	if ((V * l) <= -2e+75)
		tmp = c0 * sqrt(((A / V) / l));
	elseif ((V * l) <= -1e-114)
		tmp = c0 / sqrt(((l * V) / A));
	elseif ((V * l) <= 2e-316)
		tmp = c0 / sqrt((V / (A / l)));
	elseif ((V * l) <= 1e+262)
		tmp = (c0 / sqrt((l * V))) * sqrt(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_] := If[LessEqual[N[(V * l), $MachinePrecision], -2e+75], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-114], N[(c0 / N[Sqrt[N[(N[(l * V), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e-316], N[(c0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+262], N[(N[(c0 / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[A], $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}
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+75}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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

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

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

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


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

    1. Initial program 58.4%

      \[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-/.f6470.6

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

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

    if -1.99999999999999985e75 < (*.f64 V l) < -1.0000000000000001e-114

    1. Initial program 95.1%

      \[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-/.f6496.7

        \[\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-*.f6496.7

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

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

    if -1.0000000000000001e-114 < (*.f64 V l) < 2.000000017e-316

    1. Initial program 63.5%

      \[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-/.f6463.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-*.f6463.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.000000017e-316 < (*.f64 V l) < 1e262

    1. Initial program 83.5%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e262 < (*.f64 V l)

    1. Initial program 46.1%

      \[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-/.f6446.1

        \[\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-*.f6446.1

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

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

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

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

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

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

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

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

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

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

Alternative 12: 90.1% accurate, 0.5× speedup?

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

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


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

    1. Initial program 72.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-/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-/.f6472.7

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

      \[\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-sqrt.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < A

    1. Initial program 74.1%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 87.6% accurate, 0.5× speedup?

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

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


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

    1. Initial program 72.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-/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-/.f6472.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < A

    1. Initial program 74.1%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 74.4% accurate, 1.0× speedup?

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

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

Reproduce

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