Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.9% → 90.6%
Time: 10.0s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 73.9% accurate, 1.0× speedup?

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

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

Alternative 1: 90.6% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 40.9%

      \[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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -4.99999999999999982e-272

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, A\right)\right)\right), \mathsf{sqrt.f64}\left(\left(V \cdot \left(\mathsf{neg}\left(\ell\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, A\right)\right)\right), \mathsf{sqrt.f64}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right) \]
      3. remove-double-negN/A

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

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

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

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

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

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

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

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

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

    if -4.99999999999999982e-272 < (*.f64 V l) < 0.0

    1. Initial program 34.5%

      \[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-/.f6476.8%

        \[\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-rr76.8%

      \[\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. div-invN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \left(\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\mathsf{neg}\left(\frac{\ell}{A}\right)}\right)\right) \]
      6. *-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{\ell}{A}\right)}\right)}\right)\right) \]
      7. pow1/2N/A

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 V l) < 1.00000000000000008e284

    1. Initial program 79.2%

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

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

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

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

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

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

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

    if 1.00000000000000008e284 < (*.f64 V l)

    1. Initial program 49.0%

      \[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-/.f6488.8%

        \[\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-rr88.8%

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

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

Alternative 2: 77.1% accurate, 0.3× speedup?

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

\mathbf{elif}\;t\_0 \leq 10^{+190}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 64.9%

      \[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-/.f6471.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-rr71.1%

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

    if 3.99999999999999985e-291 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.0000000000000001e190

    1. Initial program 97.3%

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

    if 1.0000000000000001e190 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 54.9%

      \[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-/.f6471.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-rr71.9%

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

Alternative 3: 77.3% accurate, 0.3× speedup?

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

\mathbf{elif}\;t\_0 \leq 10^{+304}:\\
\;\;\;\;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)))) < 3.99999999999999985e-291

    1. Initial program 64.9%

      \[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-/.f6471.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-rr71.1%

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

    if 3.99999999999999985e-291 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 9.9999999999999994e303

    1. Initial program 96.7%

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

    if 9.9999999999999994e303 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 45.4%

      \[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-/.f6465.0%

        \[\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-rr65.0%

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

        \[\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-rr65.1%

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

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

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+192}:\\
\;\;\;\;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)))) < 3.99999999999999985e-291 or 5.00000000000000033e192 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 63.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-/.f6470.7%

        \[\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-rr70.7%

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

    if 3.99999999999999985e-291 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 5.00000000000000033e192

    1. Initial program 97.3%

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

Alternative 5: 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}{V \cdot \ell}}\\ t_1 := c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+293}:\\ \;\;\;\;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 (* V l))))) (t_1 (* c0 (sqrt (/ (/ A V) l)))))
   (if (<= t_0 0.0) t_1 (if (<= t_0 5e+293) 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 / (V * l)));
	double t_1 = c0 * sqrt(((A / V) / l));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = t_1;
	} else if (t_0 <= 5e+293) {
		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 / (v * l)))
    t_1 = c0 * sqrt(((a / v) / l))
    if (t_0 <= 0.0d0) then
        tmp = t_1
    else if (t_0 <= 5d+293) 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 / (V * l)));
	double t_1 = c0 * Math.sqrt(((A / V) / l));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = t_1;
	} else if (t_0 <= 5e+293) {
		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 / (V * l)))
	t_1 = c0 * math.sqrt(((A / V) / l))
	tmp = 0
	if t_0 <= 0.0:
		tmp = t_1
	elif t_0 <= 5e+293:
		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(V * l))))
	t_1 = Float64(c0 * sqrt(Float64(Float64(A / V) / l)))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = t_1;
	elseif (t_0 <= 5e+293)
		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 / (V * l)));
	t_1 = c0 * sqrt(((A / V) / l));
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = t_1;
	elseif (t_0 <= 5e+293)
		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[(V * l), $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, 5e+293], 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}{V \cdot \ell}}\\
t_1 := c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+293}:\\
\;\;\;\;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 5.00000000000000033e293 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 62.1%

      \[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.5%

        \[\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.5%

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

    if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 5.00000000000000033e293

    1. Initial program 96.7%

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

Alternative 6: 89.9% accurate, 0.3× speedup?

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

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

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

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


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

    1. Initial program 76.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(c0 \cdot \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) \]
      11. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

    if -4.99999999999999982e-272 < (*.f64 V l) < 0.0

    1. Initial program 34.5%

      \[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-/.f6476.8%

        \[\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-rr76.8%

      \[\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. div-invN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \left(\sqrt{\mathsf{neg}\left(V\right)} \cdot \sqrt{\mathsf{neg}\left(\frac{\ell}{A}\right)}\right)\right) \]
      6. *-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{\ell}{A}\right)}\right)}\right)\right) \]
      7. pow1/2N/A

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 V l) < 1.00000000000000008e284

    1. Initial program 79.2%

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

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

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

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

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

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

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

    if 1.00000000000000008e284 < (*.f64 V l)

    1. Initial program 49.0%

      \[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-/.f6488.8%

        \[\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-rr88.8%

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

Alternative 7: 90.5% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 40.9%

      \[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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -4.99999999999999982e-272

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, A\right)\right)\right), \mathsf{sqrt.f64}\left(\left(V \cdot \left(\mathsf{neg}\left(\ell\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, A\right)\right)\right), \mathsf{sqrt.f64}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right) \]
      3. remove-double-negN/A

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

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

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

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

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

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

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

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

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

    if -4.99999999999999982e-272 < (*.f64 V l) < 0.0

    1. Initial program 34.5%

      \[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. remove-double-negN/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{\mathsf{neg}\left(\left(\mathsf{neg}\left(A\right)\right)\right)}{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right) \]
      15. frac-2negN/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{\mathsf{neg}\left(A\right)}{\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(\left(\mathsf{neg}\left(A\right)\right), \ell\right)\right)\right)\right) \]
      17. 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(\mathsf{/.f64}\left(\left(0 - A\right), \ell\right)\right)\right)\right) \]
      18. --lowering--.f6453.5%

        \[\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(\mathsf{\_.f64}\left(0, A\right), \ell\right)\right)\right)\right) \]
    4. Applied egg-rr53.5%

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

    if 0.0 < (*.f64 V l) < 1.00000000000000008e284

    1. Initial program 79.2%

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

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

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

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

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

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

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

    if 1.00000000000000008e284 < (*.f64 V l)

    1. Initial program 49.0%

      \[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-/.f6488.8%

        \[\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-rr88.8%

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

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

Alternative 8: 90.7% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 40.9%

      \[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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -4e-296

    1. Initial program 82.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, A\right)\right)\right), \mathsf{sqrt.f64}\left(\left(V \cdot \left(\mathsf{neg}\left(\ell\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-outN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(0, A\right)\right)\right), \mathsf{sqrt.f64}\left(\left(\mathsf{neg}\left(V \cdot \ell\right)\right)\right)\right) \]
      3. remove-double-negN/A

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

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

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

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

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

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

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

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

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

    if -4e-296 < (*.f64 V l) < 5.0000000000022e-312

    1. Initial program 33.3%

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

        \[\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-rr79.3%

      \[\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-/.f6479.4%

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

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

    if 5.0000000000022e-312 < (*.f64 V l) < 1.00000000000000008e284

    1. Initial program 79.4%

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

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

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

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

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

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

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

    if 1.00000000000000008e284 < (*.f64 V l)

    1. Initial program 49.0%

      \[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-/.f6488.8%

        \[\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-rr88.8%

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

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

Alternative 9: 86.2% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 76.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999982e-272 < (*.f64 V l) < 5.0000000000022e-312

    1. Initial program 36.5%

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

        \[\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-rr78.3%

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

        \[\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-rr78.3%

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

    if 5.0000000000022e-312 < (*.f64 V l) < 1.00000000000000008e284

    1. Initial program 79.4%

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

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

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

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

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

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

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

    if 1.00000000000000008e284 < (*.f64 V l)

    1. Initial program 49.0%

      \[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-/.f6488.8%

        \[\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-rr88.8%

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

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

Alternative 10: 86.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 67.4%

      \[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.0%

        \[\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.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(c0, \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(V, A\right), \frac{1}{2}\right), \left({\ell}^{\frac{-1}{2}}\right)\right)\right) \]
      12. pow-lowering-pow.f6450.2%

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

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

    if 9.9999875e-319 < (*.f64 V l) < 1.00000000000000008e284

    1. Initial program 79.5%

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

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

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

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

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

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

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

    if 1.00000000000000008e284 < (*.f64 V l)

    1. Initial program 49.0%

      \[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-/.f6488.8%

        \[\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-rr88.8%

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

Alternative 11: 86.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 67.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, \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. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

    if 9.9999875e-319 < (*.f64 V l) < 1.00000000000000008e284

    1. Initial program 79.5%

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

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

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

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

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

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

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

    if 1.00000000000000008e284 < (*.f64 V l)

    1. Initial program 49.0%

      \[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-/.f6488.8%

        \[\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-rr88.8%

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

Alternative 12: 82.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 67.5%

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

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

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

    if 5.0000000000022e-312 < (*.f64 V l) < 1.00000000000000008e284

    1. Initial program 79.4%

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

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

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

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

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

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

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

    if 1.00000000000000008e284 < (*.f64 V l)

    1. Initial program 49.0%

      \[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-/.f6488.8%

        \[\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-rr88.8%

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

Alternative 13: 81.5% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 36.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. sqrt-divN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{\sqrt{V}} \cdot \left(\sqrt{\frac{A}{\ell}} \cdot \sqrt{1}\right) \]
      7. *-inversesN/A

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

        \[\leadsto \frac{c0}{\sqrt{V}} \cdot \sqrt{\frac{A}{\ell} \cdot \frac{\ell}{\ell}} \]
      9. times-fracN/A

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

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

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

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

        \[\leadsto \frac{c0}{\sqrt{V}} \cdot \frac{\sqrt{A \cdot \ell}}{{\ell}^{1}} \]
      14. unpow1N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{c0}{\sqrt{V}} \cdot \sqrt{A \cdot \ell}\right), \color{blue}{\ell}\right) \]
    6. Applied egg-rr35.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99006e-322 < (/.f64 A (*.f64 V l)) < 1e292

    1. Initial program 98.5%

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

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

    1. Initial program 33.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-/.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}}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification78.8%

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

Alternative 14: 73.9% accurate, 1.0× speedup?

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

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

Reproduce

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