Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.0% → 90.2%
Time: 8.7s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 74.0% 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.2% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 49.4%

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -1.00000000000000002e-294

    1. Initial program 91.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000002e-294 < (*.f64 V l) < 9.999999985e-316

    1. Initial program 53.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.999999985e-316 < (*.f64 V l) < 9.9999999999999996e290

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999996e290 < (*.f64 V l)

    1. Initial program 44.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 89.0% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 36.2%

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

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

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -1.00000000000000002e-294

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000002e-294 < (*.f64 V l) < 9.999999985e-316

    1. Initial program 37.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{A}} \cdot \ell}} \]
      5. lower-*.f6462.3

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

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

    if 9.999999985e-316 < (*.f64 V l) < 9.9999999999999996e290

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999996e290 < (*.f64 V l)

    1. Initial program 41.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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