Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.2% → 90.9%
Time: 13.1s
Alternatives: 12
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 73.2% accurate, 1.0× speedup?

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

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

Alternative 1: 90.9% accurate, 0.3× speedup?

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

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


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

    1. Initial program 79.2%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. sqrt-div42.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}} \]
    7. Step-by-step derivation
      1. frac-2neg42.9%

        \[\leadsto \frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\color{blue}{\frac{-A}{-V}}}}} \]
      2. sqrt-div48.6%

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

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

    if -4.999999999999985e-310 < A

    1. Initial program 70.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    6. Simplified86.2%

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

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

Alternative 2: 89.3% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 69.3%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 90.0%

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{-V \cdot \ell}}} \]
      3. distribute-rgt-neg-in99.2%

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

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}} \]
    5. Step-by-step derivation
      1. distribute-rgt-neg-out99.2%

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

        \[\leadsto c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\color{blue}{\ell \cdot V}}} \]
      3. distribute-rgt-neg-in99.2%

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

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

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

    1. Initial program 46.1%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. clear-num65.0%

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

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

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}} \]
      5. div-inv68.5%

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

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

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

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

      \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{\ell \cdot V}{A}}}} \]
    7. Step-by-step derivation
      1. un-div-inv46.1%

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

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

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

        \[\leadsto \frac{c0}{\color{blue}{\sqrt{\ell} \cdot \frac{\sqrt{V}}{\sqrt{A}}}} \]
      5. sqrt-div39.8%

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

        \[\leadsto \color{blue}{\frac{\frac{c0}{\sqrt{\frac{V}{A}}}}{\sqrt{\ell}}} \]
      7. div-inv39.8%

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{\sqrt{\ell}}}{\frac{\sqrt{\frac{V}{A}}}{c0}}} \]
      10. *-un-lft-identity39.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{\ell}}}}{\frac{\sqrt{\frac{V}{A}}}{c0}} \]
      11. pow1/239.8%

        \[\leadsto \frac{\frac{1}{\color{blue}{{\ell}^{0.5}}}}{\frac{\sqrt{\frac{V}{A}}}{c0}} \]
      12. pow-flip39.9%

        \[\leadsto \frac{\color{blue}{{\ell}^{\left(-0.5\right)}}}{\frac{\sqrt{\frac{V}{A}}}{c0}} \]
      13. metadata-eval39.9%

        \[\leadsto \frac{{\ell}^{\color{blue}{-0.5}}}{\frac{\sqrt{\frac{V}{A}}}{c0}} \]
    8. Applied egg-rr39.9%

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

    if -0.0 < (*.f64 V l)

    1. Initial program 71.9%

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

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

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

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

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

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

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

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

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

Alternative 3: 80.5% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 87.2%

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{\ell}{\frac{A}{V}}}}} \]
      3. sqrt-div80.7%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      4. metadata-eval80.7%

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}} \]
      5. div-inv80.7%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\ell \cdot \frac{1}{\frac{A}{V}}}}} \]
      6. clear-num80.7%

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{\ell \cdot V}{A}}}} \]
      2. *-commutative87.1%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{\color{blue}{V \cdot \ell}}{A}}} \]
      3. *-lft-identity87.1%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}}} \]
      4. times-frac77.3%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{1} \cdot \frac{\ell}{A}}}} \]
      5. remove-double-div77.3%

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{\frac{1}{V} \cdot 1}} \cdot \frac{\ell}{A}}} \]
      7. *-rgt-identity77.3%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{1}{\color{blue}{\frac{1}{V}}} \cdot \frac{\ell}{A}}} \]
      8. remove-double-div77.3%

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u62.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c0 \cdot \frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}\right)\right)} \]
      2. expm1-udef44.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(c0 \cdot \frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}\right)} - 1} \]
      3. un-div-inv44.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}}\right)} - 1 \]
      4. clear-num43.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{V \cdot \color{blue}{\frac{1}{\frac{A}{\ell}}}}}\right)} - 1 \]
      5. un-div-inv43.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}}\right)} - 1 \]
    8. Applied egg-rr43.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def61.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\right)\right)} \]
      2. expm1-log1p76.5%

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V \cdot \ell}{A}}}} \]
      4. *-commutative87.2%

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
    10. Simplified77.3%

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

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

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

    if -1.00000000000000005e-230 < (*.f64 V l) < -0.0

    1. Initial program 49.8%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. clear-num64.7%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{\ell}{\frac{A}{V}}}}} \]
      3. sqrt-div67.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      4. metadata-eval67.5%

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}} \]
      5. div-inv67.5%

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{\color{blue}{V \cdot \ell}}{A}}} \]
      3. *-lft-identity49.8%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}}} \]
      4. times-frac67.5%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{1} \cdot \frac{\ell}{A}}}} \]
      5. remove-double-div67.5%

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{\frac{1}{V} \cdot 1}} \cdot \frac{\ell}{A}}} \]
      7. *-rgt-identity67.5%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{1}{\color{blue}{\frac{1}{V}}} \cdot \frac{\ell}{A}}} \]
      8. remove-double-div67.5%

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    7. Step-by-step derivation
      1. un-div-inv67.5%

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
      2. clear-num67.4%

        \[\leadsto \frac{c0}{\sqrt{V \cdot \color{blue}{\frac{1}{\frac{A}{\ell}}}}} \]
      3. un-div-inv67.5%

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 71.9%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. clear-num63.4%

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      4. metadata-eval64.0%

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}} \]
      5. div-inv64.0%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\ell \cdot \frac{1}{\frac{A}{V}}}}} \]
      6. clear-num64.2%

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{\ell \cdot V}{A}}}} \]
      2. *-commutative71.2%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{\color{blue}{V \cdot \ell}}{A}}} \]
      3. *-lft-identity71.2%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}}} \]
      4. times-frac63.7%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{1} \cdot \frac{\ell}{A}}}} \]
      5. remove-double-div63.7%

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{\frac{1}{V} \cdot 1}} \cdot \frac{\ell}{A}}} \]
      7. *-rgt-identity63.7%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{1}{\color{blue}{\frac{1}{V}}} \cdot \frac{\ell}{A}}} \]
      8. remove-double-div63.7%

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u44.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c0 \cdot \frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}\right)\right)} \]
      2. expm1-udef25.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(c0 \cdot \frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}\right)} - 1} \]
      3. un-div-inv25.2%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}}\right)} - 1 \]
      4. clear-num25.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{V \cdot \color{blue}{\frac{1}{\frac{A}{\ell}}}}}\right)} - 1 \]
      5. un-div-inv25.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}}\right)} - 1 \]
    8. Applied egg-rr25.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def44.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\right)\right)} \]
      2. expm1-log1p63.8%

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V \cdot \ell}{A}}}} \]
      4. *-commutative71.2%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 81.7% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 87.2%

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

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{\ell}{\frac{A}{V}}}}} \]
      3. sqrt-div80.7%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      4. metadata-eval80.7%

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}} \]
      5. div-inv80.7%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\ell \cdot \frac{1}{\frac{A}{V}}}}} \]
      6. clear-num80.7%

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{\ell \cdot V}{A}}}} \]
      2. *-commutative87.1%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{\color{blue}{V \cdot \ell}}{A}}} \]
      3. *-lft-identity87.1%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}}} \]
      4. times-frac77.3%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{1} \cdot \frac{\ell}{A}}}} \]
      5. remove-double-div77.3%

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{\frac{1}{V} \cdot 1}} \cdot \frac{\ell}{A}}} \]
      7. *-rgt-identity77.3%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{1}{\color{blue}{\frac{1}{V}}} \cdot \frac{\ell}{A}}} \]
      8. remove-double-div77.3%

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u62.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c0 \cdot \frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}\right)\right)} \]
      2. expm1-udef44.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(c0 \cdot \frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}\right)} - 1} \]
      3. un-div-inv44.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}}\right)} - 1 \]
      4. clear-num43.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{V \cdot \color{blue}{\frac{1}{\frac{A}{\ell}}}}}\right)} - 1 \]
      5. un-div-inv43.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\color{blue}{\frac{V}{\frac{A}{\ell}}}}}\right)} - 1 \]
    8. Applied egg-rr43.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def61.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\right)\right)} \]
      2. expm1-log1p76.5%

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V \cdot \ell}{A}}}} \]
      4. *-commutative87.2%

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
    10. Simplified77.3%

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

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

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

    if -1.00000000000000005e-230 < (*.f64 V l) < -0.0

    1. Initial program 49.8%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. clear-num64.7%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{\ell}{\frac{A}{V}}}}} \]
      3. sqrt-div67.5%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      4. metadata-eval67.5%

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}} \]
      5. div-inv67.5%

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{\color{blue}{V \cdot \ell}}{A}}} \]
      3. *-lft-identity49.8%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}}} \]
      4. times-frac67.5%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{1} \cdot \frac{\ell}{A}}}} \]
      5. remove-double-div67.5%

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{\frac{1}{V} \cdot 1}} \cdot \frac{\ell}{A}}} \]
      7. *-rgt-identity67.5%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{1}{\color{blue}{\frac{1}{V}}} \cdot \frac{\ell}{A}}} \]
      8. remove-double-div67.5%

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    7. Step-by-step derivation
      1. un-div-inv67.5%

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
      2. clear-num67.4%

        \[\leadsto \frac{c0}{\sqrt{V \cdot \color{blue}{\frac{1}{\frac{A}{\ell}}}}} \]
      3. un-div-inv67.5%

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 71.9%

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

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

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

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

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

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

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

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

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

Alternative 5: 74.7% accurate, 0.5× speedup?

\[\begin{array}{l} [c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\ \\ \begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{\ell \cdot V}}\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+274}:\\ \;\;\;\;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 (* l V))))))
   (if (<= t_0 5e+274) 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 / (l * V)));
	double tmp;
	if (t_0 <= 5e+274) {
		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 / (l * v)))
    if (t_0 <= 5d+274) 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 / (l * V)));
	double tmp;
	if (t_0 <= 5e+274) {
		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 / (l * V)))
	tmp = 0
	if t_0 <= 5e+274:
		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(l * V))))
	tmp = 0.0
	if (t_0 <= 5e+274)
		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 / (l * V)));
	tmp = 0.0;
	if (t_0 <= 5e+274)
		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[(l * V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+274], 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}{\ell \cdot V}}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+274}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 78.8%

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

    if 4.9999999999999998e274 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 50.9%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. clear-num61.6%

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{\ell \cdot V}{A}}}} \]
      2. *-commutative50.9%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{\color{blue}{V \cdot \ell}}{A}}} \]
      3. *-lft-identity50.9%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}}} \]
      4. times-frac63.5%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{1} \cdot \frac{\ell}{A}}}} \]
      5. remove-double-div63.4%

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{\frac{1}{V} \cdot 1}} \cdot \frac{\ell}{A}}} \]
      7. *-rgt-identity63.4%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{1}{\color{blue}{\frac{1}{V}}} \cdot \frac{\ell}{A}}} \]
      8. remove-double-div63.5%

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    7. Step-by-step derivation
      1. un-div-inv63.4%

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
      2. clear-num63.3%

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

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

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

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

Alternative 6: 83.9% accurate, 0.5× speedup?

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

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


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

    1. Initial program 79.2%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. clear-num78.3%

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

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

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}} \]
      5. div-inv79.1%

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

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

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

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

        \[\leadsto c0 \cdot {\color{blue}{\left(\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}\right)}}^{-1} \]
      3. unpow-prod-down42.9%

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

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

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

        \[\leadsto c0 \cdot \left(\color{blue}{{\ell}^{\left(-0.5\right)}} \cdot {\left(\sqrt{\frac{V}{A}}\right)}^{-1}\right) \]
      7. metadata-eval42.9%

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{{\ell}^{-0.5} \cdot 1}{\sqrt{\frac{V}{A}}}} \]
      3. *-rgt-identity43.0%

        \[\leadsto c0 \cdot \frac{\color{blue}{{\ell}^{-0.5}}}{\sqrt{\frac{V}{A}}} \]
    8. Simplified43.0%

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

    if -4.999999999999985e-310 < A

    1. Initial program 70.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    6. Simplified86.2%

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

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

Alternative 7: 83.8% accurate, 0.5× speedup?

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

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


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

    1. Initial program 79.2%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. sqrt-div42.9%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < A

    1. Initial program 70.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    6. Simplified86.2%

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

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

Alternative 8: 83.9% accurate, 0.5× speedup?

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

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


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

    1. Initial program 79.2%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. clear-num78.3%

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

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

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}} \]
      5. div-inv79.1%

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

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

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

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

      \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{\ell \cdot V}{A}}}} \]
    7. Step-by-step derivation
      1. un-div-inv79.2%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{c0}{\sqrt{\frac{V}{A}}}}{\sqrt{\ell}}} \]
      7. div-inv42.1%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\frac{V}{A}}}{c0}}} \cdot \frac{1}{\sqrt{\ell}} \]
      9. frac-times40.5%

        \[\leadsto \color{blue}{\frac{1 \cdot 1}{\frac{\sqrt{\frac{V}{A}}}{c0} \cdot \sqrt{\ell}}} \]
      10. metadata-eval40.5%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot c0}{\sqrt{\frac{V}{A}}}}}{\sqrt{\ell}} \]
      3. *-lft-identity42.1%

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

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}} \]
    10. Simplified43.0%

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

    if -4.999999999999985e-310 < A

    1. Initial program 70.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0} \]
    6. Simplified86.2%

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

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

Alternative 9: 75.8% accurate, 0.9× speedup?

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

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


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

    1. Initial program 86.3%

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

    if 9.9999999999999998e294 < (/.f64 A (*.f64 V l))

    1. Initial program 38.8%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Step-by-step derivation
      1. *-commutative38.8%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
    3. Simplified48.1%

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

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

Alternative 10: 76.1% accurate, 0.9× speedup?

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

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


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

    1. Initial program 86.3%

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

    if 9.9999999999999998e294 < (/.f64 A (*.f64 V l))

    1. Initial program 38.8%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. clear-num48.1%

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{\ell}{\frac{A}{V}}}}} \]
      3. sqrt-div50.9%

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      4. metadata-eval50.9%

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

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

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

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

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

      \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{\ell \cdot V}{A}}}} \]
    7. Step-by-step derivation
      1. un-div-inv39.8%

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{\frac{A}{V}}}}} \]
      3. div-inv50.8%

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

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

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

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

Alternative 11: 75.6% accurate, 0.9× speedup?

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

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


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

    1. Initial program 86.1%

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

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

    1. Initial program 41.6%

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

        \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
      2. clear-num47.5%

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

        \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
      4. metadata-eval50.2%

        \[\leadsto c0 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{\ell}{\frac{A}{V}}}} \]
      5. div-inv50.1%

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{\ell \cdot V}{A}}}} \]
      2. *-commutative42.6%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{\color{blue}{V \cdot \ell}}{A}}} \]
      3. *-lft-identity42.6%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}}} \]
      4. times-frac52.2%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{V}{1} \cdot \frac{\ell}{A}}}} \]
      5. remove-double-div52.1%

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{\frac{1}{V} \cdot 1}} \cdot \frac{\ell}{A}}} \]
      7. *-rgt-identity52.1%

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\frac{1}{\color{blue}{\frac{1}{V}}} \cdot \frac{\ell}{A}}} \]
      8. remove-double-div52.2%

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

      \[\leadsto c0 \cdot \color{blue}{\frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u25.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c0 \cdot \frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}\right)\right)} \]
      2. expm1-udef25.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(c0 \cdot \frac{1}{\sqrt{V \cdot \frac{\ell}{A}}}\right)} - 1} \]
      3. un-div-inv25.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}}\right)} - 1 \]
      4. clear-num25.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{V \cdot \color{blue}{\frac{1}{\frac{A}{\ell}}}}}\right)} - 1 \]
      5. un-div-inv25.8%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def25.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\right)\right)} \]
      2. expm1-log1p52.2%

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

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{\ell}{A} \cdot V}}} \]
    10. Simplified52.2%

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

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

Alternative 12: 73.2% accurate, 1.0× speedup?

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

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

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

Reproduce

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