Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.5% → 90.5%
Time: 13.2s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 73.5% 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.5% accurate, 0.3× speedup?

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

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


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

    1. Initial program 79.8%

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

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

        \[\leadsto c0 \cdot {\color{blue}{\left(\frac{\frac{A}{V}}{\ell}\right)}}^{0.5} \]
      3. div-inv76.5%

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < A

    1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

Alternative 2: 89.7% accurate, 0.3× speedup?

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

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


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

    1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < A

    1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

Alternative 3: 86.2% accurate, 0.5× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 V l) < -1.99999999999999989e183 or -1.00000000000000003e-139 < (*.f64 V l) < 2.0000024e-318

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999989e183 < (*.f64 V l) < -1.00000000000000003e-139

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto c0 \cdot \color{blue}{{\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u60.3%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{{\left(V \cdot \frac{\ell}{A}\right)}^{0.5}}}\right)} - 1 \]
      5. pow1/224.2%

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{c0}{\sqrt{\frac{\ell}{A}}}}{\sqrt{V}}}\right)} - 1 \]
      11. associate-/l/12.5%

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

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

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

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

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

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

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

    if 2.0000024e-318 < (*.f64 V l) < 9.99999999999999961e225

    1. Initial program 82.3%

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

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

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

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

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

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

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

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

    if 9.99999999999999961e225 < (*.f64 V l)

    1. Initial program 52.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 85.1%

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

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

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

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

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

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

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

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

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

    if -1.99999999998e-313 < (*.f64 V l) < 4.99006e-322

    1. Initial program 48.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\frac{1}{{\left(V \cdot \frac{\ell}{A}\right)}^{0.5}}} \]
      3. pow1/260.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{\sqrt{\ell}} \cdot \frac{\sqrt{A}}{\sqrt{V}}} \]
      10. sqrt-div31.4%

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

        \[\leadsto \color{blue}{\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}} \]
      12. add-sqr-sqrt10.4%

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

        \[\leadsto \color{blue}{\sqrt{\left(\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\right) \cdot \left(\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\right)}} \]
      14. swap-sqr10.5%

        \[\leadsto \sqrt{\color{blue}{\left(\sqrt{\frac{A}{V}} \cdot \sqrt{\frac{A}{V}}\right) \cdot \left(\frac{c0}{\sqrt{\ell}} \cdot \frac{c0}{\sqrt{\ell}}\right)}} \]
      15. add-sqr-sqrt10.5%

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

        \[\leadsto \sqrt{\frac{A}{V} \cdot \color{blue}{\frac{c0 \cdot c0}{\sqrt{\ell} \cdot \sqrt{\ell}}}} \]
      17. pow210.5%

        \[\leadsto \sqrt{\frac{A}{V} \cdot \frac{\color{blue}{{c0}^{2}}}{\sqrt{\ell} \cdot \sqrt{\ell}}} \]
      18. add-sqr-sqrt28.7%

        \[\leadsto \sqrt{\frac{A}{V} \cdot \frac{{c0}^{2}}{\color{blue}{\ell}}} \]
    10. Applied egg-rr28.7%

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

    if 4.99006e-322 < (*.f64 V l) < 9.99999999999999961e225

    1. Initial program 81.4%

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

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

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

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

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

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

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

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

    if 9.99999999999999961e225 < (*.f64 V l)

    1. Initial program 52.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 70.9%

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

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

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

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

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

    1. Initial program 84.3%

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

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

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

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


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

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999996e-306 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l))))

    1. Initial program 84.2%

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

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

Alternative 7: 78.8% accurate, 0.5× speedup?

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

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


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

    1. Initial program 38.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot \frac{\sqrt{A}}{\sqrt{V}}}}{\sqrt{\ell}} \]
      10. sqrt-div51.4%

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

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

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

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

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

    if 1.999999999999994e-310 < (/.f64 A (*.f64 V l))

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\right)\right)} \]
      2. expm1-udef29.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\right)} - 1} \]
      3. metadata-eval29.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{\color{blue}{\left(-0.5\right)}}\right)} - 1 \]
      4. pow-flip29.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{{\left(V \cdot \frac{\ell}{A}\right)}^{0.5}}}\right)} - 1 \]
      5. pow1/229.9%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{c0}{\sqrt{\frac{\ell}{A}}}}{\sqrt{V}}}\right)} - 1 \]
      9. div-inv17.4%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{c0}{\sqrt{\frac{\ell}{A}}}}{\sqrt{V}}}\right)} - 1 \]
      11. associate-/l/17.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\sqrt{V} \cdot \sqrt{\frac{\ell}{A}}}}\right)} - 1 \]
      12. sqrt-prod29.9%

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

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

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

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

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

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

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

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

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


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

    1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < A

    1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

Alternative 9: 76.9% accurate, 0.9× speedup?

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

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


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

    1. Initial program 38.9%

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

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

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

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

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

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

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

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

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

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

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

    if 1.999999999999994e-310 < (/.f64 A (*.f64 V l))

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\right)\right)} \]
      2. expm1-udef29.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\right)} - 1} \]
      3. metadata-eval29.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{\color{blue}{\left(-0.5\right)}}\right)} - 1 \]
      4. pow-flip29.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{{\left(V \cdot \frac{\ell}{A}\right)}^{0.5}}}\right)} - 1 \]
      5. pow1/229.9%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{c0}{\sqrt{\frac{\ell}{A}}}}{\sqrt{V}}}\right)} - 1 \]
      9. div-inv17.4%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{c0}{\sqrt{\frac{\ell}{A}}}}{\sqrt{V}}}\right)} - 1 \]
      11. associate-/l/17.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\sqrt{V} \cdot \sqrt{\frac{\ell}{A}}}}\right)} - 1 \]
      12. sqrt-prod29.9%

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

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

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

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

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

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

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

Alternative 10: 77.0% accurate, 0.9× speedup?

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

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


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

    1. Initial program 38.9%

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

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

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

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

    if 1.999999999999994e-310 < (/.f64 A (*.f64 V l))

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\right)\right)} \]
      2. expm1-udef29.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\right)} - 1} \]
      3. metadata-eval29.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{\color{blue}{\left(-0.5\right)}}\right)} - 1 \]
      4. pow-flip29.9%

        \[\leadsto e^{\mathsf{log1p}\left(c0 \cdot \color{blue}{\frac{1}{{\left(V \cdot \frac{\ell}{A}\right)}^{0.5}}}\right)} - 1 \]
      5. pow1/229.9%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{c0}{\sqrt{\frac{\ell}{A}}}}{\sqrt{V}}}\right)} - 1 \]
      9. div-inv17.4%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{c0}{\sqrt{\frac{\ell}{A}}}}{\sqrt{V}}}\right)} - 1 \]
      11. associate-/l/17.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c0}{\sqrt{V} \cdot \sqrt{\frac{\ell}{A}}}}\right)} - 1 \]
      12. sqrt-prod29.9%

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

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

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

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

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

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

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

Alternative 11: 73.5% 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 76.2%

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

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

Reproduce

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