Henrywood and Agarwal, Equation (3)

Percentage Accurate: 74.4% → 90.9%
Time: 7.7s
Alternatives: 10
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 10 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.4% accurate, 1.0× speedup?

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

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

Alternative 1: 90.9% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 79.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-/l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{neg}\left(A\right)} \cdot \left(\mathsf{neg}\left(c0\right)\right)}{\sqrt{\mathsf{neg}\left(V\right)} \cdot \left(\mathsf{neg}\left(\sqrt{\ell}\right)\right)}} \]
    6. Applied rewrites96.6%

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

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

    1. Initial program 34.5%

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. 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-/l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\left(\ell \cdot V\right) \cdot {A}^{\left(\frac{1}{2} \cdot -1 + \color{blue}{\frac{1}{2} \cdot -1}\right)}}} \]
      7. pow-prod-upN/A

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\left(\ell \cdot V\right) \cdot \color{blue}{\left({A}^{\left(\frac{1}{2} \cdot -1\right)} \cdot {A}^{\left(\frac{1}{2} \cdot -1\right)}\right)}}} \]
      8. pow-prod-downN/A

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\left(\ell \cdot V\right) \cdot {\left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)\right) \cdot A\right)}^{\left(\frac{1}{2} \cdot -1\right)}}} \]
      11. remove-double-negN/A

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\left(\ell \cdot V\right) \cdot {\color{blue}{\left(\left(\mathsf{neg}\left(A\right)\right) \cdot \left(\mathsf{neg}\left(A\right)\right)\right)}}^{\left(\frac{1}{2} \cdot -1\right)}}} \]
      14. pow-prod-downN/A

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\left(\ell \cdot V\right) \cdot \color{blue}{\left({\left(\mathsf{neg}\left(A\right)\right)}^{\left(\frac{1}{2} \cdot -1\right)} \cdot {\left(\mathsf{neg}\left(A\right)\right)}^{\left(\frac{1}{2} \cdot -1\right)}\right)}}} \]
      15. pow-prod-upN/A

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

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

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

        \[\leadsto c0 \cdot \frac{1}{\sqrt{\left(\ell \cdot V\right) \cdot {\left(\mathsf{neg}\left(A\right)\right)}^{\color{blue}{-1}}}} \]
      19. inv-powN/A

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

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

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

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

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

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999994e304

    1. Initial program 80.1%

      \[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. sqrt-divN/A

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

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

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

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

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

    if 9.9999999999999994e304 < (*.f64 V l)

    1. Initial program 31.9%

      \[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-/l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 76.9% accurate, 0.3× speedup?

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

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+272}:\\
\;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\

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


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

    1. Initial program 69.4%

      \[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-/l/N/A

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

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

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

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

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

    1. Initial program 98.8%

      \[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. clear-numN/A

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

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

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

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

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

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

    1. Initial program 48.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-/l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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