Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.7% → 87.5%
Time: 10.0s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 73.7% accurate, 1.0× speedup?

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

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

Alternative 1: 87.5% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 52.4%

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{c0}{\sqrt{\ell}}\right), \color{blue}{\left(\sqrt{\frac{A}{V}}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \left(\sqrt{\ell}\right)\right), \left(\sqrt{\color{blue}{\frac{A}{V}}}\right)\right) \]
      7. sqrt-lowering-sqrt.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{A}{V}\right)\right)\right) \]
      9. /-lowering-/.f6446.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, V\right)\right)\right) \]
    4. Applied egg-rr46.9%

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

    if -4.99999999999999983e218 < (*.f64 V l) < -1e-255

    1. Initial program 90.3%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\mathsf{neg}\left(A\right)}\right), \color{blue}{\left({\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}^{\frac{1}{2}} \cdot c0\right)}\right) \]
      8. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(\left({\left(\mathsf{neg}\left(A\right)\right)}^{\frac{1}{2}}\right), \left(\color{blue}{{\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}^{\frac{1}{2}}} \cdot c0\right)\right) \]
      9. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\mathsf{neg}\left(A\right)\right), \frac{1}{2}\right), \left(\color{blue}{{\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}^{\frac{1}{2}}} \cdot c0\right)\right) \]
      10. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(0 - A\right), \frac{1}{2}\right), \left({\color{blue}{\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}}^{\frac{1}{2}} \cdot c0\right)\right) \]
      11. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \left({\color{blue}{\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}}^{\frac{1}{2}} \cdot c0\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\left({\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}^{\frac{1}{2}}\right), \color{blue}{c0}\right)\right) \]
      13. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\left(\sqrt{\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}}\right), c0\right)\right) \]
      14. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)\right), c0\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(V \cdot \ell\right)}\right)\right), c0\right)\right) \]
      16. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{-1}{V \cdot \ell}\right)\right), c0\right)\right) \]
      17. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, \left(V \cdot \ell\right)\right)\right), c0\right)\right) \]
      18. *-lowering-*.f6499.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(V, \ell\right)\right)\right), c0\right)\right) \]
    4. Applied egg-rr99.5%

      \[\leadsto \color{blue}{{\left(0 - A\right)}^{0.5} \cdot \left(\sqrt{\frac{-1}{V \cdot \ell}} \cdot c0\right)} \]
    5. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\mathsf{neg}\left(A\right)\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(V, \ell\right)\right)}\right), c0\right)\right) \]
      2. neg-lowering-neg.f6499.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{neg.f64}\left(A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(V, \ell\right)\right)}\right), c0\right)\right) \]
    6. Applied egg-rr99.5%

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

    if -1e-255 < (*.f64 V l) < 5.00000000000023e-311

    1. Initial program 56.5%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{\frac{1}{2}}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)}^{\frac{1}{2}}\right)\right) \]
      3. inv-powN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left({\left(\frac{V \cdot \ell}{A}\right)}^{-1}\right)}^{\frac{1}{2}}\right)\right) \]
      4. pow-powN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{V \cdot \ell}{A}\right)}^{\color{blue}{\left(-1 \cdot \frac{1}{2}\right)}}\right)\right) \]
      5. pow-lowering-pow.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right), \left(\color{blue}{-1} \cdot \frac{1}{2}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right), \left(\color{blue}{-1} \cdot \frac{1}{2}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right), \left(-1 \cdot \frac{1}{2}\right)\right)\right) \]
      10. metadata-eval74.6%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right), \frac{-1}{2}\right)\right) \]
    4. Applied egg-rr74.6%

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

    if 5.00000000000023e-311 < (*.f64 V l) < 2.0000000000000001e289

    1. Initial program 89.1%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{\ell \cdot V}{A}}\right)\right)\right) \]
      3. associate-/l*N/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{1}{\ell}}{\frac{V}{A}}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{\ell}\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      7. /-lowering-/.f6478.8%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \mathsf{/.f64}\left(V, A\right)\right)\right)\right) \]
    4. Applied egg-rr78.8%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot \frac{1}{{\ell}^{\frac{1}{2}}}}{\sqrt{\frac{V}{A}}} \]
      8. un-div-invN/A

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

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

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

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

        \[\leadsto \frac{c0}{{\ell}^{\frac{1}{2}} \cdot {V}^{\frac{1}{2}}} \cdot \sqrt{\color{blue}{A}} \]
      13. unpow-prod-downN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(c0 \cdot \sqrt{A}\right), \color{blue}{\left({\left(V \cdot \ell\right)}^{\frac{1}{2}}\right)}\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \left(\sqrt{A}\right)\right), \left({\color{blue}{\left(V \cdot \ell\right)}}^{\frac{1}{2}}\right)\right) \]
      18. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \left({\left(V \cdot \color{blue}{\ell}\right)}^{\frac{1}{2}}\right)\right) \]
      19. unpow1/2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \left(\sqrt{V \cdot \ell}\right)\right) \]
      20. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\left(V \cdot \ell\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\left(\ell \cdot V\right)\right)\right) \]
      22. *-lowering-*.f6496.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\ell, V\right)\right)\right) \]
    6. Applied egg-rr96.5%

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

    if 2.0000000000000001e289 < (*.f64 V l)

    1. Initial program 46.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      8. associate-/r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right)\right)\right) \]
      10. /-lowering-/.f6472.9%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right)\right)\right) \]
    4. Applied egg-rr72.9%

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

        \[\leadsto \mathsf{/.f64}\left(c0, \left(\sqrt{\frac{\mathsf{neg}\left(V\right)}{\mathsf{neg}\left(\frac{A}{\ell}\right)}}\right)\right) \]
      2. sqrt-divN/A

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, V\right)\right), \left(\sqrt{\mathsf{neg}\left(\color{blue}{\frac{A}{\ell}}\right)}\right)\right)\right) \]
      7. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, V\right)\right), \mathsf{sqrt.f64}\left(\left(\mathsf{neg}\left(\frac{A}{\ell}\right)\right)\right)\right)\right) \]
      8. distribute-neg-frac2N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, V\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{A}{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right) \]
      9. sub0-negN/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, V\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{A}{0 - \ell}\right)\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, V\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, \left(0 - \ell\right)\right)\right)\right)\right) \]
      11. --lowering--.f6464.8%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, V\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, \mathsf{\_.f64}\left(0, \ell\right)\right)\right)\right)\right) \]
    6. Applied egg-rr64.8%

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

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

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

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


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

    1. Initial program 76.3%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{\frac{1}{2}}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)}^{\frac{1}{2}}\right)\right) \]
      3. inv-powN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left({\left(\frac{V \cdot \ell}{A}\right)}^{-1}\right)}^{\frac{1}{2}}\right)\right) \]
      4. pow-powN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{V \cdot \ell}{A}\right)}^{\color{blue}{\left(-1 \cdot \frac{1}{2}\right)}}\right)\right) \]
      5. pow-lowering-pow.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right), \left(\color{blue}{-1} \cdot \frac{1}{2}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right), \left(\color{blue}{-1} \cdot \frac{1}{2}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right), \left(-1 \cdot \frac{1}{2}\right)\right)\right) \]
      10. metadata-eval81.2%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right), \frac{-1}{2}\right)\right) \]
    4. Applied egg-rr81.2%

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

    if 4.99999999999999969e-279 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.9999999999999999e268

    1. Initial program 97.6%

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

    if 1.9999999999999999e268 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 45.2%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      8. associate-/r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right)\right)\right) \]
      10. /-lowering-/.f6457.5%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right)\right)\right) \]
    4. Applied egg-rr57.5%

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{V}{A}\right), \ell\right)\right)\right) \]
      3. /-lowering-/.f6459.8%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(V, A\right), \ell\right)\right)\right) \]
    6. Applied egg-rr59.8%

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

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

Alternative 3: 76.9% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 75.4%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{A}{V}}{\ell}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{A}{V}\right), \ell\right)\right)\right) \]
      3. /-lowering-/.f6473.7%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(A, V\right), \ell\right)\right)\right) \]
    4. Applied egg-rr73.7%

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

    if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.9999999999999999e268

    1. Initial program 97.7%

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

    if 1.9999999999999999e268 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 45.2%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      8. associate-/r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right)\right)\right) \]
      10. /-lowering-/.f6457.5%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right)\right)\right) \]
    4. Applied egg-rr57.5%

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{V}{A}\right), \ell\right)\right)\right) \]
      3. /-lowering-/.f6459.8%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(V, A\right), \ell\right)\right)\right) \]
    6. Applied egg-rr59.8%

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

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

Alternative 4: 76.9% accurate, 0.3× speedup?

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

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+297}:\\
\;\;\;\;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)))) < 0.0

    1. Initial program 75.4%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{A}{V}}{\ell}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{A}{V}\right), \ell\right)\right)\right) \]
      3. /-lowering-/.f6473.7%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(A, V\right), \ell\right)\right)\right) \]
    4. Applied egg-rr73.7%

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

    if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 2e297

    1. Initial program 97.7%

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

    if 2e297 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 43.0%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{A}{\ell}}{V}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{A}{\ell}\right), V\right)\right)\right) \]
      3. /-lowering-/.f6458.1%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(A, \ell\right), V\right)\right)\right) \]
    4. Applied egg-rr58.1%

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

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

Alternative 5: 76.7% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 70.9%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{A}{V}}{\ell}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{A}{V}\right), \ell\right)\right)\right) \]
      3. /-lowering-/.f6471.6%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(A, V\right), \ell\right)\right)\right) \]
    4. Applied egg-rr71.6%

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

    if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.9999999999999999e268

    1. Initial program 97.7%

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

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

Alternative 6: 89.6% accurate, 0.3× speedup?

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

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


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

    1. Initial program 80.8%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{\frac{A}{V}}{\ell}}\right)\right) \]
      2. sqrt-divN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\sqrt{\frac{A}{V}}}{\color{blue}{\sqrt{\ell}}}\right)\right) \]
      3. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\sqrt{\frac{\mathsf{neg}\left(A\right)}{\mathsf{neg}\left(V\right)}}}{\sqrt{\ell}}\right)\right) \]
      4. sqrt-divN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(V\right)}}}{\sqrt{\color{blue}{\ell}}}\right)\right) \]
      5. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{{\left(\mathsf{neg}\left(V\right)\right)}^{\frac{1}{2}}}}{\sqrt{\ell}}\right)\right) \]
      6. associate-/l/N/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\ell}}}{\color{blue}{{\left(\mathsf{neg}\left(V\right)\right)}^{\frac{1}{2}}}}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\left(\frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\ell}}\right), \color{blue}{\left({\left(\mathsf{neg}\left(V\right)\right)}^{\frac{1}{2}}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{\mathsf{neg}\left(A\right)}\right), \left(\sqrt{\ell}\right)\right), \left({\color{blue}{\left(\mathsf{neg}\left(V\right)\right)}}^{\frac{1}{2}}\right)\right)\right) \]
      10. pow1/2N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(0 - A\right), \frac{1}{2}\right), \left(\sqrt{\ell}\right)\right), \left({\left(\mathsf{neg}\left(V\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
      13. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \left(\sqrt{\ell}\right)\right), \left({\left(\mathsf{neg}\left(V\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
      14. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\ell\right)\right), \left({\left(\mathsf{neg}\left(V\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
      15. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\ell\right)\right), \left(\sqrt{\mathsf{neg}\left(V\right)}\right)\right)\right) \]
      16. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\left(\mathsf{neg}\left(V\right)\right)\right)\right)\right) \]
      17. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\left(0 - V\right)\right)\right)\right) \]
      18. --lowering--.f6443.2%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, V\right)\right)\right)\right) \]
    4. Applied egg-rr43.2%

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

    if -3.999999999999988e-310 < A

    1. Initial program 77.9%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{\ell \cdot V}{A}}\right)\right)\right) \]
      3. associate-/l*N/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{1}{\ell}}{\frac{V}{A}}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{\ell}\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      7. /-lowering-/.f6476.6%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \mathsf{/.f64}\left(V, A\right)\right)\right)\right) \]
    4. Applied egg-rr76.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot \frac{1}{{\ell}^{\frac{1}{2}}}}{\sqrt{\frac{V}{A}}} \]
      8. un-div-invN/A

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

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

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

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

        \[\leadsto \frac{c0}{{\ell}^{\frac{1}{2}} \cdot {V}^{\frac{1}{2}}} \cdot \sqrt{\color{blue}{A}} \]
      13. unpow-prod-downN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(c0 \cdot \sqrt{A}\right), \color{blue}{\left({\left(V \cdot \ell\right)}^{\frac{1}{2}}\right)}\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \left(\sqrt{A}\right)\right), \left({\color{blue}{\left(V \cdot \ell\right)}}^{\frac{1}{2}}\right)\right) \]
      18. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \left({\left(V \cdot \color{blue}{\ell}\right)}^{\frac{1}{2}}\right)\right) \]
      19. unpow1/2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \left(\sqrt{V \cdot \ell}\right)\right) \]
      20. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\left(V \cdot \ell\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\left(\ell \cdot V\right)\right)\right) \]
      22. *-lowering-*.f6483.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\ell, V\right)\right)\right) \]
    6. Applied egg-rr83.6%

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

Alternative 7: 87.5% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 52.4%

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{c0}{\sqrt{\ell}}\right), \color{blue}{\left(\sqrt{\frac{A}{V}}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \left(\sqrt{\ell}\right)\right), \left(\sqrt{\color{blue}{\frac{A}{V}}}\right)\right) \]
      7. sqrt-lowering-sqrt.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{A}{V}\right)\right)\right) \]
      9. /-lowering-/.f6446.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, V\right)\right)\right) \]
    4. Applied egg-rr46.9%

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

    if -4.99999999999999983e218 < (*.f64 V l) < -1e-255

    1. Initial program 90.3%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\mathsf{neg}\left(A\right)}\right), \color{blue}{\left({\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}^{\frac{1}{2}} \cdot c0\right)}\right) \]
      8. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(\left({\left(\mathsf{neg}\left(A\right)\right)}^{\frac{1}{2}}\right), \left(\color{blue}{{\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}^{\frac{1}{2}}} \cdot c0\right)\right) \]
      9. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\mathsf{neg}\left(A\right)\right), \frac{1}{2}\right), \left(\color{blue}{{\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}^{\frac{1}{2}}} \cdot c0\right)\right) \]
      10. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(0 - A\right), \frac{1}{2}\right), \left({\color{blue}{\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}}^{\frac{1}{2}} \cdot c0\right)\right) \]
      11. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \left({\color{blue}{\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}}^{\frac{1}{2}} \cdot c0\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\left({\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)}^{\frac{1}{2}}\right), \color{blue}{c0}\right)\right) \]
      13. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\left(\sqrt{\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}}\right), c0\right)\right) \]
      14. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{1}{\mathsf{neg}\left(V \cdot \ell\right)}\right)\right), c0\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(V \cdot \ell\right)}\right)\right), c0\right)\right) \]
      16. frac-2negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{-1}{V \cdot \ell}\right)\right), c0\right)\right) \]
      17. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, \left(V \cdot \ell\right)\right)\right), c0\right)\right) \]
      18. *-lowering-*.f6499.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{\_.f64}\left(0, A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(V, \ell\right)\right)\right), c0\right)\right) \]
    4. Applied egg-rr99.5%

      \[\leadsto \color{blue}{{\left(0 - A\right)}^{0.5} \cdot \left(\sqrt{\frac{-1}{V \cdot \ell}} \cdot c0\right)} \]
    5. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\mathsf{neg}\left(A\right)\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(V, \ell\right)\right)}\right), c0\right)\right) \]
      2. neg-lowering-neg.f6499.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{neg.f64}\left(A\right), \frac{1}{2}\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(V, \ell\right)\right)}\right), c0\right)\right) \]
    6. Applied egg-rr99.5%

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

    if -1e-255 < (*.f64 V l) < 5.00000000000023e-311

    1. Initial program 56.5%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{\frac{1}{2}}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)}^{\frac{1}{2}}\right)\right) \]
      3. inv-powN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left({\left(\frac{V \cdot \ell}{A}\right)}^{-1}\right)}^{\frac{1}{2}}\right)\right) \]
      4. pow-powN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{V \cdot \ell}{A}\right)}^{\color{blue}{\left(-1 \cdot \frac{1}{2}\right)}}\right)\right) \]
      5. pow-lowering-pow.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right), \left(\color{blue}{-1} \cdot \frac{1}{2}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right), \left(\color{blue}{-1} \cdot \frac{1}{2}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right), \left(-1 \cdot \frac{1}{2}\right)\right)\right) \]
      10. metadata-eval74.6%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right), \frac{-1}{2}\right)\right) \]
    4. Applied egg-rr74.6%

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

    if 5.00000000000023e-311 < (*.f64 V l) < 2.0000000000000001e289

    1. Initial program 89.1%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{\ell \cdot V}{A}}\right)\right)\right) \]
      3. associate-/l*N/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{1}{\ell}}{\frac{V}{A}}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{\ell}\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      7. /-lowering-/.f6478.8%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \mathsf{/.f64}\left(V, A\right)\right)\right)\right) \]
    4. Applied egg-rr78.8%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot \frac{1}{{\ell}^{\frac{1}{2}}}}{\sqrt{\frac{V}{A}}} \]
      8. un-div-invN/A

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

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

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

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

        \[\leadsto \frac{c0}{{\ell}^{\frac{1}{2}} \cdot {V}^{\frac{1}{2}}} \cdot \sqrt{\color{blue}{A}} \]
      13. unpow-prod-downN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(c0 \cdot \sqrt{A}\right), \color{blue}{\left({\left(V \cdot \ell\right)}^{\frac{1}{2}}\right)}\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \left(\sqrt{A}\right)\right), \left({\color{blue}{\left(V \cdot \ell\right)}}^{\frac{1}{2}}\right)\right) \]
      18. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \left({\left(V \cdot \color{blue}{\ell}\right)}^{\frac{1}{2}}\right)\right) \]
      19. unpow1/2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \left(\sqrt{V \cdot \ell}\right)\right) \]
      20. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\left(V \cdot \ell\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\left(\ell \cdot V\right)\right)\right) \]
      22. *-lowering-*.f6496.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\ell, V\right)\right)\right) \]
    6. Applied egg-rr96.5%

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

    if 2.0000000000000001e289 < (*.f64 V l)

    1. Initial program 46.0%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{\frac{A}{\ell}}{V}}\right)\right) \]
      2. frac-2negN/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\sqrt{\mathsf{neg}\left(\frac{A}{\ell}\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(V\right)}}}\right)\right) \]
      4. distribute-frac-neg2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\sqrt{\frac{A}{\mathsf{neg}\left(\ell\right)}}}{\sqrt{\mathsf{neg}\left(\color{blue}{V}\right)}}\right)\right) \]
      5. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\sqrt{\frac{A}{\mathsf{neg}\left(\ell\right)}}}{{\left(\mathsf{neg}\left(V\right)\right)}^{\color{blue}{\frac{1}{2}}}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\left(\sqrt{\frac{A}{\mathsf{neg}\left(\ell\right)}}\right), \color{blue}{\left({\left(\mathsf{neg}\left(V\right)\right)}^{\frac{1}{2}}\right)}\right)\right) \]
      7. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{A}{\mathsf{neg}\left(\ell\right)}\right)\right), \left({\color{blue}{\left(\mathsf{neg}\left(V\right)\right)}}^{\frac{1}{2}}\right)\right)\right) \]
      8. distribute-frac-neg2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\mathsf{neg}\left(\frac{A}{\ell}\right)\right)\right), \left({\left(\mathsf{neg}\left(\color{blue}{V}\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
      9. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(0 - \frac{A}{\ell}\right)\right), \left({\left(\mathsf{neg}\left(\color{blue}{V}\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{A}{\ell}\right)\right)\right), \left({\left(\mathsf{neg}\left(\color{blue}{V}\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(A, \ell\right)\right)\right), \left({\left(\mathsf{neg}\left(V\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
      12. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(A, \ell\right)\right)\right), \left(\sqrt{\mathsf{neg}\left(V\right)}\right)\right)\right) \]
      13. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(A, \ell\right)\right)\right), \mathsf{sqrt.f64}\left(\left(\mathsf{neg}\left(V\right)\right)\right)\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(A, \ell\right)\right)\right), \mathsf{sqrt.f64}\left(\left(0 - V\right)\right)\right)\right) \]
      15. --lowering--.f6464.8%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(A, \ell\right)\right)\right), \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, V\right)\right)\right)\right) \]
    4. Applied egg-rr64.8%

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

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

Alternative 8: 83.7% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;\ell \cdot V \leq 10^{-291}:\\
\;\;\;\;t\_0\\

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

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


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

    1. Initial program 55.8%

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{c0}{\sqrt{\ell}}\right), \color{blue}{\left(\sqrt{\frac{A}{V}}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \left(\sqrt{\ell}\right)\right), \left(\sqrt{\color{blue}{\frac{A}{V}}}\right)\right) \]
      7. sqrt-lowering-sqrt.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{A}{V}\right)\right)\right) \]
      9. /-lowering-/.f6440.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, V\right)\right)\right) \]
    4. Applied egg-rr40.0%

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

    if -5e176 < (*.f64 V l) < -1.00000000000000006e-158

    1. Initial program 94.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      8. associate-/r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right)\right)\right) \]
      10. /-lowering-/.f6486.9%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right)\right)\right) \]
    4. Applied egg-rr86.9%

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\ell \cdot \frac{V}{A}\right)\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\ell \cdot V}{A}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\ell \cdot V\right), A\right)\right)\right) \]
      5. *-lowering-*.f6494.0%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\ell, V\right), A\right)\right)\right) \]
    6. Applied egg-rr94.0%

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

    if -1.00000000000000006e-158 < (*.f64 V l) < 9.99999999999999962e-292 or 3.99999999999999991e102 < (*.f64 V l)

    1. Initial program 69.8%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{A}{\ell}}{V}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{A}{\ell}\right), V\right)\right)\right) \]
      3. /-lowering-/.f6480.8%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(A, \ell\right), V\right)\right)\right) \]
    4. Applied egg-rr80.8%

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

    if 9.99999999999999962e-292 < (*.f64 V l) < 3.99999999999999991e102

    1. Initial program 88.2%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{\ell \cdot V}{A}}\right)\right)\right) \]
      3. associate-/l*N/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{1}{\ell}}{\frac{V}{A}}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{\ell}\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      7. /-lowering-/.f6476.4%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \mathsf{/.f64}\left(V, A\right)\right)\right)\right) \]
    4. Applied egg-rr76.4%

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0 \]
      7. unpow1/2N/A

        \[\leadsto \frac{\sqrt{A}}{{\left(V \cdot \ell\right)}^{\frac{1}{2}}} \cdot c0 \]
      8. associate-/r/N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{A}\right), \color{blue}{\left(\frac{{\left(V \cdot \ell\right)}^{\frac{1}{2}}}{c0}\right)}\right) \]
      10. sqrt-lowering-sqrt.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(A\right), \mathsf{/.f64}\left(\left({\left(V \cdot \ell\right)}^{\frac{1}{2}}\right), \color{blue}{c0}\right)\right) \]
      12. unpow1/2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(A\right), \mathsf{/.f64}\left(\left(\sqrt{V \cdot \ell}\right), c0\right)\right) \]
      13. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(A\right), \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(V \cdot \ell\right)\right), c0\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(A\right), \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\ell \cdot V\right)\right), c0\right)\right) \]
      15. *-lowering-*.f6497.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(A\right), \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\ell, V\right)\right), c0\right)\right) \]
    6. Applied egg-rr97.0%

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

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

Alternative 9: 84.4% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 55.8%

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{c0}{\sqrt{\ell}}\right), \color{blue}{\left(\sqrt{\frac{A}{V}}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \left(\sqrt{\ell}\right)\right), \left(\sqrt{\color{blue}{\frac{A}{V}}}\right)\right) \]
      7. sqrt-lowering-sqrt.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{A}{V}\right)\right)\right) \]
      9. /-lowering-/.f6440.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, V\right)\right)\right) \]
    4. Applied egg-rr40.0%

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

    if -5e176 < (*.f64 V l) < -1.00000000000000006e-158

    1. Initial program 94.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      8. associate-/r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right)\right)\right) \]
      10. /-lowering-/.f6486.9%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right)\right)\right) \]
    4. Applied egg-rr86.9%

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\ell \cdot \frac{V}{A}\right)\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\ell \cdot V}{A}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\ell \cdot V\right), A\right)\right)\right) \]
      5. *-lowering-*.f6494.0%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\ell, V\right), A\right)\right)\right) \]
    6. Applied egg-rr94.0%

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

    if -1.00000000000000006e-158 < (*.f64 V l) < 9.99999999999999962e-292

    1. Initial program 66.4%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{A}{\ell}}{V}\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{A}{\ell}\right), V\right)\right)\right) \]
      3. /-lowering-/.f6478.3%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(A, \ell\right), V\right)\right)\right) \]
    4. Applied egg-rr78.3%

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

    if 9.99999999999999962e-292 < (*.f64 V l) < 1e176

    1. Initial program 88.7%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{\ell \cdot V}{A}}\right)\right)\right) \]
      3. associate-/l*N/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{1}{\ell}}{\frac{V}{A}}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{\ell}\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      7. /-lowering-/.f6476.9%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \mathsf{/.f64}\left(V, A\right)\right)\right)\right) \]
    4. Applied egg-rr76.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot \frac{1}{{\ell}^{\frac{1}{2}}}}{\sqrt{\frac{V}{A}}} \]
      8. un-div-invN/A

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

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

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

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

        \[\leadsto \frac{c0}{{\ell}^{\frac{1}{2}} \cdot {V}^{\frac{1}{2}}} \cdot \sqrt{\color{blue}{A}} \]
      13. unpow-prod-downN/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \left({\left(V \cdot \ell\right)}^{\frac{1}{2}}\right)\right), \left(\sqrt{\color{blue}{A}}\right)\right) \]
      17. unpow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \left(\sqrt{V \cdot \ell}\right)\right), \left(\sqrt{A}\right)\right) \]
      18. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(V \cdot \ell\right)\right)\right), \left(\sqrt{A}\right)\right) \]
      19. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\ell \cdot V\right)\right)\right), \left(\sqrt{A}\right)\right) \]
      20. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\ell, V\right)\right)\right), \left(\sqrt{A}\right)\right) \]
      21. sqrt-lowering-sqrt.f6494.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\ell, V\right)\right)\right), \mathsf{sqrt.f64}\left(A\right)\right) \]
    6. Applied egg-rr94.4%

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

    if 1e176 < (*.f64 V l)

    1. Initial program 65.7%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      8. associate-/r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right)\right)\right) \]
      10. /-lowering-/.f6480.9%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right)\right)\right) \]
    4. Applied egg-rr80.9%

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{V}{A}\right), \ell\right)\right)\right) \]
      3. /-lowering-/.f6481.0%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(V, A\right), \ell\right)\right)\right) \]
    6. Applied egg-rr81.0%

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

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

Alternative 10: 84.7% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 55.8%

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{c0}{\sqrt{\ell}}\right), \color{blue}{\left(\sqrt{\frac{A}{V}}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \left(\sqrt{\ell}\right)\right), \left(\sqrt{\color{blue}{\frac{A}{V}}}\right)\right) \]
      7. sqrt-lowering-sqrt.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{A}{V}\right)\right)\right) \]
      9. /-lowering-/.f6440.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\ell\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, V\right)\right)\right) \]
    4. Applied egg-rr40.0%

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

    if -5e176 < (*.f64 V l) < -2e-266

    1. Initial program 92.1%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      8. associate-/r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right)\right)\right) \]
      10. /-lowering-/.f6486.6%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right)\right)\right) \]
    4. Applied egg-rr86.6%

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{V}{A} \cdot \ell\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\ell \cdot \frac{V}{A}\right)\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\ell \cdot V}{A}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\ell \cdot V\right), A\right)\right)\right) \]
      5. *-lowering-*.f6492.1%

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\ell, V\right), A\right)\right)\right) \]
    6. Applied egg-rr92.1%

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

    if -2e-266 < (*.f64 V l) < 5.00000000000023e-311

    1. Initial program 54.1%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{A}{V \cdot \ell}\right)}^{\color{blue}{\frac{1}{2}}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)}^{\frac{1}{2}}\right)\right) \]
      3. inv-powN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left({\left(\frac{V \cdot \ell}{A}\right)}^{-1}\right)}^{\frac{1}{2}}\right)\right) \]
      4. pow-powN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left({\left(\frac{V \cdot \ell}{A}\right)}^{\color{blue}{\left(-1 \cdot \frac{1}{2}\right)}}\right)\right) \]
      5. pow-lowering-pow.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\left(\frac{V}{\frac{A}{\ell}}\right), \left(\color{blue}{-1} \cdot \frac{1}{2}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \left(\frac{A}{\ell}\right)\right), \left(\color{blue}{-1} \cdot \frac{1}{2}\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right), \left(-1 \cdot \frac{1}{2}\right)\right)\right) \]
      10. metadata-eval73.2%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, \mathsf{/.f64}\left(A, \ell\right)\right), \frac{-1}{2}\right)\right) \]
    4. Applied egg-rr73.2%

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

    if 5.00000000000023e-311 < (*.f64 V l)

    1. Initial program 83.4%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{\ell \cdot V}{A}}\right)\right)\right) \]
      3. associate-/l*N/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{1}{\ell}}{\frac{V}{A}}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{\ell}\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      7. /-lowering-/.f6478.0%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \mathsf{/.f64}\left(V, A\right)\right)\right)\right) \]
    4. Applied egg-rr78.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot \frac{1}{{\ell}^{\frac{1}{2}}}}{\sqrt{\frac{V}{A}}} \]
      8. un-div-invN/A

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

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

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

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

        \[\leadsto \frac{c0}{{\ell}^{\frac{1}{2}} \cdot {V}^{\frac{1}{2}}} \cdot \sqrt{\color{blue}{A}} \]
      13. unpow-prod-downN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(c0 \cdot \sqrt{A}\right), \color{blue}{\left({\left(V \cdot \ell\right)}^{\frac{1}{2}}\right)}\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \left(\sqrt{A}\right)\right), \left({\color{blue}{\left(V \cdot \ell\right)}}^{\frac{1}{2}}\right)\right) \]
      18. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \left({\left(V \cdot \color{blue}{\ell}\right)}^{\frac{1}{2}}\right)\right) \]
      19. unpow1/2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \left(\sqrt{V \cdot \ell}\right)\right) \]
      20. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\left(V \cdot \ell\right)\right)\right) \]
      21. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\left(\ell \cdot V\right)\right)\right) \]
      22. *-lowering-*.f6489.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(A\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\ell, V\right)\right)\right) \]
    6. Applied egg-rr89.8%

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

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

Alternative 11: 84.5% accurate, 0.5× speedup?

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

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


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

    1. Initial program 80.4%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{\mathsf{neg}\left(A\right)}{\mathsf{neg}\left(V \cdot \ell\right)}}\right)\right) \]
      2. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{-1 \cdot A}{\mathsf{neg}\left(V \cdot \ell\right)}}\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{-1 \cdot A}{V \cdot \left(\mathsf{neg}\left(\ell\right)\right)}}\right)\right) \]
      4. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{-1}{V} \cdot \frac{A}{\mathsf{neg}\left(\ell\right)}}\right)\right) \]
      5. sqrt-prodN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{1}{\mathsf{neg}\left(V\right)}} \cdot \sqrt{\frac{A}{\mathsf{neg}\left(\ell\right)}}\right)\right) \]
      8. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, V\right)\right), \left(\sqrt{\frac{\color{blue}{A}}{\mathsf{neg}\left(\ell\right)}}\right)\right)\right) \]
      13. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, V\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{A}{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right) \]
      14. distribute-frac-neg2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, V\right)\right), \mathsf{sqrt.f64}\left(\left(\mathsf{neg}\left(\frac{A}{\ell}\right)\right)\right)\right)\right) \]
      15. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, V\right)\right), \mathsf{sqrt.f64}\left(\left(0 - \frac{A}{\ell}\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, V\right)\right), \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{A}{\ell}\right)\right)\right)\right)\right) \]
      17. /-lowering-/.f6487.8%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(-1, V\right)\right), \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(A, \ell\right)\right)\right)\right)\right) \]
    4. Applied egg-rr87.8%

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

    if -1.000000000000002e-309 < V

    1. Initial program 78.5%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{1}{\frac{\ell \cdot V}{A}}\right)\right)\right) \]
      3. associate-/l*N/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\left(\frac{\frac{1}{\ell}}{\frac{V}{A}}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{\ell}\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \left(\frac{V}{A}\right)\right)\right)\right) \]
      7. /-lowering-/.f6476.7%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \ell\right), \mathsf{/.f64}\left(V, A\right)\right)\right)\right) \]
    4. Applied egg-rr76.7%

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{1}{\frac{V}{A} \cdot \ell}}\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{1 \cdot 1}{\frac{V}{A} \cdot \ell}}\right)\right) \]
      3. frac-timesN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{1}{\frac{V}{A}} \cdot \frac{1}{\ell}}\right)\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{A}{V} \cdot \frac{1}{\ell}}\right)\right) \]
      5. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\sqrt{\frac{A \cdot \frac{1}{\ell}}{V}}\right)\right) \]
      6. sqrt-divN/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\sqrt{\frac{A}{\ell}}}{\sqrt{V}}\right)\right) \]
      8. sqrt-undivN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\frac{\sqrt{A}}{\sqrt{\ell}}}{\sqrt{\color{blue}{V}}}\right)\right) \]
      9. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\frac{\sqrt{A}}{{\ell}^{\frac{1}{2}}}}{\sqrt{V}}\right)\right) \]
      10. unpow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \left(\frac{\frac{\sqrt{A}}{{\ell}^{\frac{1}{2}}}}{{V}^{\color{blue}{\frac{1}{2}}}}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\left(\frac{\sqrt{A}}{{\ell}^{\frac{1}{2}}}\right), \color{blue}{\left({V}^{\frac{1}{2}}\right)}\right)\right) \]
      12. pow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\left(\frac{\sqrt{A}}{\sqrt{\ell}}\right), \left({V}^{\frac{1}{2}}\right)\right)\right) \]
      13. sqrt-undivN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\left(\sqrt{\frac{A}{\ell}}\right), \left({\color{blue}{V}}^{\frac{1}{2}}\right)\right)\right) \]
      14. div-invN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\left(\sqrt{A \cdot \frac{1}{\ell}}\right), \left({V}^{\frac{1}{2}}\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\left(\sqrt{\frac{1}{\ell} \cdot A}\right), \left({V}^{\frac{1}{2}}\right)\right)\right) \]
      16. sqrt-lowering-sqrt.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(A \cdot \frac{1}{\ell}\right)\right), \left({V}^{\frac{1}{2}}\right)\right)\right) \]
      18. div-invN/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{A}{\ell}\right)\right), \left({V}^{\frac{1}{2}}\right)\right)\right) \]
      19. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, \ell\right)\right), \left({V}^{\frac{1}{2}}\right)\right)\right) \]
      20. unpow1/2N/A

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, \ell\right)\right), \left(\sqrt{V}\right)\right)\right) \]
      21. sqrt-lowering-sqrt.f6488.9%

        \[\leadsto \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(A, \ell\right)\right), \mathsf{sqrt.f64}\left(V\right)\right)\right) \]
    6. Applied egg-rr88.9%

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

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

Alternative 12: 73.7% accurate, 1.0× speedup?

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

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

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

Reproduce

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