Henrywood and Agarwal, Equation (3)

Percentage Accurate: 73.8% → 89.3%
Time: 7.9s
Alternatives: 9
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 9 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.8% 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: 89.3% accurate, 0.4× speedup?

\[\begin{array}{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 -4 \cdot 10^{-307}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\ell \cdot V}}\\ \mathbf{elif}\;\ell \cdot V \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;\ell \cdot V \leq 2 \cdot 10^{+291}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot V}} \cdot \sqrt{A}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \end{array} \]
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* l V) (- INFINITY))
   (* c0 (sqrt (/ (/ A V) l)))
   (if (<= (* l V) -4e-307)
     (* c0 (/ (sqrt (- A)) (sqrt (- (* l V)))))
     (if (<= (* l V) 0.0)
       (* c0 (sqrt (/ (/ A l) V)))
       (if (<= (* l V) 2e+291)
         (* (/ c0 (sqrt (* l V))) (sqrt A))
         (/ c0 (sqrt (* l (/ V A)))))))))
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) <= -4e-307) {
		tmp = c0 * (sqrt(-A) / sqrt(-(l * V)));
	} else if ((l * V) <= 0.0) {
		tmp = c0 * sqrt(((A / l) / V));
	} else if ((l * V) <= 2e+291) {
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	} else {
		tmp = c0 / sqrt((l * (V / A)));
	}
	return tmp;
}
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) <= -4e-307) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt(-(l * V)));
	} else if ((l * V) <= 0.0) {
		tmp = c0 * Math.sqrt(((A / l) / V));
	} else if ((l * V) <= 2e+291) {
		tmp = (c0 / Math.sqrt((l * V))) * Math.sqrt(A);
	} else {
		tmp = c0 / Math.sqrt((l * (V / A)));
	}
	return tmp;
}
def code(c0, A, V, l):
	tmp = 0
	if (l * V) <= -math.inf:
		tmp = c0 * math.sqrt(((A / V) / l))
	elif (l * V) <= -4e-307:
		tmp = c0 * (math.sqrt(-A) / math.sqrt(-(l * V)))
	elif (l * V) <= 0.0:
		tmp = c0 * math.sqrt(((A / l) / V))
	elif (l * V) <= 2e+291:
		tmp = (c0 / math.sqrt((l * V))) * math.sqrt(A)
	else:
		tmp = c0 / math.sqrt((l * (V / A)))
	return tmp
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) <= -4e-307)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(-Float64(l * V)))));
	elseif (Float64(l * V) <= 0.0)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V)));
	elseif (Float64(l * V) <= 2e+291)
		tmp = Float64(Float64(c0 / sqrt(Float64(l * V))) * sqrt(A));
	else
		tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A))));
	end
	return tmp
end
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((l * V) <= -Inf)
		tmp = c0 * sqrt(((A / V) / l));
	elseif ((l * V) <= -4e-307)
		tmp = c0 * (sqrt(-A) / sqrt(-(l * V)));
	elseif ((l * V) <= 0.0)
		tmp = c0 * sqrt(((A / l) / V));
	elseif ((l * V) <= 2e+291)
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	else
		tmp = c0 / sqrt((l * (V / A)));
	end
	tmp_2 = tmp;
end
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], -4e-307], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[(-N[(l * V), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 0.0], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 2e+291], N[(N[(c0 / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{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 -4 \cdot 10^{-307}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\ell \cdot V}}\\

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

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

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


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

    1. Initial program 24.0%

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

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

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

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

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

    if -inf.0 < (*.f64 V l) < -3.99999999999999964e-307

    1. Initial program 85.2%

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

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

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

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
    5. Step-by-step derivation
      1. associate-/r*N/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. frac-2negN/A

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

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

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

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

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

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

        \[\leadsto c0 \cdot \frac{\sqrt{\mathsf{neg}\left(A\right)}}{\sqrt{\mathsf{neg}\left(\color{blue}{V \cdot \ell}\right)}} \]
      10. 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)}}} \]
      11. 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)}}} \]
      12. lower-neg.f6499.4

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

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

    if -3.99999999999999964e-307 < (*.f64 V l) < 0.0

    1. Initial program 41.6%

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

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

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

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

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

    if 0.0 < (*.f64 V l) < 1.9999999999999999e291

    1. Initial program 83.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{\frac{A}{\color{blue}{V \cdot \ell}}} \]
      2. sqrt-divN/A

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e291 < (*.f64 V l)

    1. Initial program 46.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{\frac{A}{\color{blue}{V \cdot \ell}}} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V}{A} \cdot \ell}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification91.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 -4 \cdot 10^{-307}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\ell \cdot V}}\\ \mathbf{elif}\;\ell \cdot V \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;\ell \cdot V \leq 2 \cdot 10^{+291}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot V}} \cdot \sqrt{A}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 79.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{A}{\ell \cdot V}\\ \mathbf{if}\;t\_0 \leq 4 \cdot 10^{-278}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+269}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell \cdot V}{A}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \end{array} \]
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (/ A (* l V))))
   (if (<= t_0 4e-278)
     (* c0 (sqrt (/ (/ A V) l)))
     (if (<= t_0 2e+269)
       (/ c0 (sqrt (/ (* l V) A)))
       (/ c0 (sqrt (* l (/ V A))))))))
double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double tmp;
	if (t_0 <= 4e-278) {
		tmp = c0 * sqrt(((A / V) / l));
	} else if (t_0 <= 2e+269) {
		tmp = c0 / sqrt(((l * V) / A));
	} else {
		tmp = c0 / sqrt((l * (V / A)));
	}
	return tmp;
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: tmp
    t_0 = a / (l * v)
    if (t_0 <= 4d-278) then
        tmp = c0 * sqrt(((a / v) / l))
    else if (t_0 <= 2d+269) then
        tmp = c0 / sqrt(((l * v) / a))
    else
        tmp = c0 / sqrt((l * (v / a)))
    end if
    code = tmp
end function
public static double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double tmp;
	if (t_0 <= 4e-278) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else if (t_0 <= 2e+269) {
		tmp = c0 / Math.sqrt(((l * V) / A));
	} else {
		tmp = c0 / Math.sqrt((l * (V / A)));
	}
	return tmp;
}
def code(c0, A, V, l):
	t_0 = A / (l * V)
	tmp = 0
	if t_0 <= 4e-278:
		tmp = c0 * math.sqrt(((A / V) / l))
	elif t_0 <= 2e+269:
		tmp = c0 / math.sqrt(((l * V) / A))
	else:
		tmp = c0 / math.sqrt((l * (V / A)))
	return tmp
function code(c0, A, V, l)
	t_0 = Float64(A / Float64(l * V))
	tmp = 0.0
	if (t_0 <= 4e-278)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	elseif (t_0 <= 2e+269)
		tmp = Float64(c0 / sqrt(Float64(Float64(l * V) / A)));
	else
		tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A))));
	end
	return tmp
end
function tmp_2 = code(c0, A, V, l)
	t_0 = A / (l * V);
	tmp = 0.0;
	if (t_0 <= 4e-278)
		tmp = c0 * sqrt(((A / V) / l));
	elseif (t_0 <= 2e+269)
		tmp = c0 / sqrt(((l * V) / A));
	else
		tmp = c0 / sqrt((l * (V / A)));
	end
	tmp_2 = tmp;
end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(l * V), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 4e-278], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+269], N[(c0 / N[Sqrt[N[(N[(l * V), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
\mathbf{if}\;t\_0 \leq 4 \cdot 10^{-278}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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

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


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

    1. Initial program 45.3%

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

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

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

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

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

    if 3.99999999999999975e-278 < (/.f64 A (*.f64 V l)) < 2.0000000000000001e269

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 44.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{\frac{A}{\color{blue}{V \cdot \ell}}} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 79.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{A}{\ell \cdot V}\\ \mathbf{if}\;t\_0 \leq 2 \cdot 10^{-273}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+269}:\\ \;\;\;\;c0 \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \end{array} \]
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (/ A (* l V))))
   (if (<= t_0 2e-273)
     (* c0 (sqrt (/ (/ A V) l)))
     (if (<= t_0 2e+269) (* c0 (sqrt t_0)) (/ c0 (sqrt (* l (/ V A))))))))
double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double tmp;
	if (t_0 <= 2e-273) {
		tmp = c0 * sqrt(((A / V) / l));
	} else if (t_0 <= 2e+269) {
		tmp = c0 * sqrt(t_0);
	} else {
		tmp = c0 / sqrt((l * (V / A)));
	}
	return tmp;
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: tmp
    t_0 = a / (l * v)
    if (t_0 <= 2d-273) then
        tmp = c0 * sqrt(((a / v) / l))
    else if (t_0 <= 2d+269) then
        tmp = c0 * sqrt(t_0)
    else
        tmp = c0 / sqrt((l * (v / a)))
    end if
    code = tmp
end function
public static double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double tmp;
	if (t_0 <= 2e-273) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else if (t_0 <= 2e+269) {
		tmp = c0 * Math.sqrt(t_0);
	} else {
		tmp = c0 / Math.sqrt((l * (V / A)));
	}
	return tmp;
}
def code(c0, A, V, l):
	t_0 = A / (l * V)
	tmp = 0
	if t_0 <= 2e-273:
		tmp = c0 * math.sqrt(((A / V) / l))
	elif t_0 <= 2e+269:
		tmp = c0 * math.sqrt(t_0)
	else:
		tmp = c0 / math.sqrt((l * (V / A)))
	return tmp
function code(c0, A, V, l)
	t_0 = Float64(A / Float64(l * V))
	tmp = 0.0
	if (t_0 <= 2e-273)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	elseif (t_0 <= 2e+269)
		tmp = Float64(c0 * sqrt(t_0));
	else
		tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A))));
	end
	return tmp
end
function tmp_2 = code(c0, A, V, l)
	t_0 = A / (l * V);
	tmp = 0.0;
	if (t_0 <= 2e-273)
		tmp = c0 * sqrt(((A / V) / l));
	elseif (t_0 <= 2e+269)
		tmp = c0 * sqrt(t_0);
	else
		tmp = c0 / sqrt((l * (V / A)));
	end
	tmp_2 = tmp;
end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(l * V), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-273], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+269], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-273}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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

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


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

    1. Initial program 47.1%

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

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

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

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

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

    if 2e-273 < (/.f64 A (*.f64 V l)) < 2.0000000000000001e269

    1. Initial program 99.6%

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

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

    1. Initial program 44.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{\frac{A}{\color{blue}{V \cdot \ell}}} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 78.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{A}{\ell \cdot V}\\ \mathbf{if}\;t\_0 \leq 2 \cdot 10^{-273}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t\_0 \leq 10^{+225}:\\ \;\;\;\;c0 \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \end{array} \end{array} \]
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (/ A (* l V))))
   (if (<= t_0 2e-273)
     (* c0 (sqrt (/ (/ A V) l)))
     (if (<= t_0 1e+225) (* c0 (sqrt t_0)) (* c0 (sqrt (/ (/ A l) V)))))))
double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double tmp;
	if (t_0 <= 2e-273) {
		tmp = c0 * sqrt(((A / V) / l));
	} else if (t_0 <= 1e+225) {
		tmp = c0 * sqrt(t_0);
	} else {
		tmp = c0 * sqrt(((A / l) / V));
	}
	return tmp;
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: tmp
    t_0 = a / (l * v)
    if (t_0 <= 2d-273) then
        tmp = c0 * sqrt(((a / v) / l))
    else if (t_0 <= 1d+225) then
        tmp = c0 * sqrt(t_0)
    else
        tmp = c0 * sqrt(((a / l) / v))
    end if
    code = tmp
end function
public static double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double tmp;
	if (t_0 <= 2e-273) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else if (t_0 <= 1e+225) {
		tmp = c0 * Math.sqrt(t_0);
	} else {
		tmp = c0 * Math.sqrt(((A / l) / V));
	}
	return tmp;
}
def code(c0, A, V, l):
	t_0 = A / (l * V)
	tmp = 0
	if t_0 <= 2e-273:
		tmp = c0 * math.sqrt(((A / V) / l))
	elif t_0 <= 1e+225:
		tmp = c0 * math.sqrt(t_0)
	else:
		tmp = c0 * math.sqrt(((A / l) / V))
	return tmp
function code(c0, A, V, l)
	t_0 = Float64(A / Float64(l * V))
	tmp = 0.0
	if (t_0 <= 2e-273)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	elseif (t_0 <= 1e+225)
		tmp = Float64(c0 * sqrt(t_0));
	else
		tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V)));
	end
	return tmp
end
function tmp_2 = code(c0, A, V, l)
	t_0 = A / (l * V);
	tmp = 0.0;
	if (t_0 <= 2e-273)
		tmp = c0 * sqrt(((A / V) / l));
	elseif (t_0 <= 1e+225)
		tmp = c0 * sqrt(t_0);
	else
		tmp = c0 * sqrt(((A / l) / V));
	end
	tmp_2 = tmp;
end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(l * V), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-273], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+225], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-273}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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

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


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

    1. Initial program 47.1%

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

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

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

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

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

    if 2e-273 < (/.f64 A (*.f64 V l)) < 9.99999999999999928e224

    1. Initial program 99.6%

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

    if 9.99999999999999928e224 < (/.f64 A (*.f64 V l))

    1. Initial program 49.4%

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

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

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

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

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

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

Alternative 5: 79.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{A}{\ell \cdot V}\\ t_1 := c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{if}\;t\_0 \leq 2 \cdot 10^{-273}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+269}:\\ \;\;\;\;c0 \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (/ A (* l V))) (t_1 (* c0 (sqrt (/ (/ A V) l)))))
   (if (<= t_0 2e-273) t_1 (if (<= t_0 2e+269) (* c0 (sqrt t_0)) t_1))))
double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double t_1 = c0 * sqrt(((A / V) / l));
	double tmp;
	if (t_0 <= 2e-273) {
		tmp = t_1;
	} else if (t_0 <= 2e+269) {
		tmp = c0 * sqrt(t_0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = a / (l * v)
    t_1 = c0 * sqrt(((a / v) / l))
    if (t_0 <= 2d-273) then
        tmp = t_1
    else if (t_0 <= 2d+269) then
        tmp = c0 * sqrt(t_0)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double c0, double A, double V, double l) {
	double t_0 = A / (l * V);
	double t_1 = c0 * Math.sqrt(((A / V) / l));
	double tmp;
	if (t_0 <= 2e-273) {
		tmp = t_1;
	} else if (t_0 <= 2e+269) {
		tmp = c0 * Math.sqrt(t_0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(c0, A, V, l):
	t_0 = A / (l * V)
	t_1 = c0 * math.sqrt(((A / V) / l))
	tmp = 0
	if t_0 <= 2e-273:
		tmp = t_1
	elif t_0 <= 2e+269:
		tmp = c0 * math.sqrt(t_0)
	else:
		tmp = t_1
	return tmp
function code(c0, A, V, l)
	t_0 = Float64(A / Float64(l * V))
	t_1 = Float64(c0 * sqrt(Float64(Float64(A / V) / l)))
	tmp = 0.0
	if (t_0 <= 2e-273)
		tmp = t_1;
	elseif (t_0 <= 2e+269)
		tmp = Float64(c0 * sqrt(t_0));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(c0, A, V, l)
	t_0 = A / (l * V);
	t_1 = c0 * sqrt(((A / V) / l));
	tmp = 0.0;
	if (t_0 <= 2e-273)
		tmp = t_1;
	elseif (t_0 <= 2e+269)
		tmp = c0 * sqrt(t_0);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(l * V), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-273], t$95$1, If[LessEqual[t$95$0, 2e+269], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
t_1 := c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-273}:\\
\;\;\;\;t\_1\\

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

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


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

    1. Initial program 45.8%

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

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

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

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

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

    if 2e-273 < (/.f64 A (*.f64 V l)) < 2.0000000000000001e269

    1. Initial program 99.6%

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

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

Alternative 6: 64.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \cdot V \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;\ell \cdot V \leq 2 \cdot 10^{+291}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot V}} \cdot \sqrt{A}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \end{array} \]
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* l V) 0.0)
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (if (<= (* l V) 2e+291)
     (* (/ c0 (sqrt (* l V))) (sqrt A))
     (/ c0 (sqrt (* l (/ V A)))))))
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((l * V) <= 0.0) {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	} else if ((l * V) <= 2e+291) {
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	} else {
		tmp = c0 / sqrt((l * (V / A)));
	}
	return tmp;
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if ((l * v) <= 0.0d0) then
        tmp = c0 * (sqrt((a / v)) / sqrt(l))
    else if ((l * v) <= 2d+291) then
        tmp = (c0 / sqrt((l * v))) * sqrt(a)
    else
        tmp = c0 / sqrt((l * (v / a)))
    end if
    code = tmp
end function
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((l * V) <= 0.0) {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	} else if ((l * V) <= 2e+291) {
		tmp = (c0 / Math.sqrt((l * V))) * Math.sqrt(A);
	} else {
		tmp = c0 / Math.sqrt((l * (V / A)));
	}
	return tmp;
}
def code(c0, A, V, l):
	tmp = 0
	if (l * V) <= 0.0:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	elif (l * V) <= 2e+291:
		tmp = (c0 / math.sqrt((l * V))) * math.sqrt(A)
	else:
		tmp = c0 / math.sqrt((l * (V / A)))
	return tmp
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(l * V) <= 0.0)
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	elseif (Float64(l * V) <= 2e+291)
		tmp = Float64(Float64(c0 / sqrt(Float64(l * V))) * sqrt(A));
	else
		tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A))));
	end
	return tmp
end
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((l * V) <= 0.0)
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	elseif ((l * V) <= 2e+291)
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	else
		tmp = c0 / sqrt((l * (V / A)));
	end
	tmp_2 = tmp;
end
code[c0_, A_, V_, l_] := If[LessEqual[N[(l * V), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 2e+291], N[(N[(c0 / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot V \leq 0:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

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

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


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

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 V l) < 1.9999999999999999e291

    1. Initial program 83.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{\frac{A}{\color{blue}{V \cdot \ell}}} \]
      2. sqrt-divN/A

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e291 < (*.f64 V l)

    1. Initial program 46.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{\frac{A}{\color{blue}{V \cdot \ell}}} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 81.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \cdot V \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;\ell \cdot V \leq 2 \cdot 10^{+291}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot V}} \cdot \sqrt{A}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \end{array} \]
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* l V) 0.0)
   (* c0 (sqrt (/ (/ A V) l)))
   (if (<= (* l V) 2e+291)
     (* (/ c0 (sqrt (* l V))) (sqrt A))
     (/ c0 (sqrt (* l (/ V A)))))))
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((l * V) <= 0.0) {
		tmp = c0 * sqrt(((A / V) / l));
	} else if ((l * V) <= 2e+291) {
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	} else {
		tmp = c0 / sqrt((l * (V / A)));
	}
	return tmp;
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if ((l * v) <= 0.0d0) then
        tmp = c0 * sqrt(((a / v) / l))
    else if ((l * v) <= 2d+291) then
        tmp = (c0 / sqrt((l * v))) * sqrt(a)
    else
        tmp = c0 / sqrt((l * (v / a)))
    end if
    code = tmp
end function
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((l * V) <= 0.0) {
		tmp = c0 * Math.sqrt(((A / V) / l));
	} else if ((l * V) <= 2e+291) {
		tmp = (c0 / Math.sqrt((l * V))) * Math.sqrt(A);
	} else {
		tmp = c0 / Math.sqrt((l * (V / A)));
	}
	return tmp;
}
def code(c0, A, V, l):
	tmp = 0
	if (l * V) <= 0.0:
		tmp = c0 * math.sqrt(((A / V) / l))
	elif (l * V) <= 2e+291:
		tmp = (c0 / math.sqrt((l * V))) * math.sqrt(A)
	else:
		tmp = c0 / math.sqrt((l * (V / A)))
	return tmp
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(l * V) <= 0.0)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l)));
	elseif (Float64(l * V) <= 2e+291)
		tmp = Float64(Float64(c0 / sqrt(Float64(l * V))) * sqrt(A));
	else
		tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A))));
	end
	return tmp
end
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((l * V) <= 0.0)
		tmp = c0 * sqrt(((A / V) / l));
	elseif ((l * V) <= 2e+291)
		tmp = (c0 / sqrt((l * V))) * sqrt(A);
	else
		tmp = c0 / sqrt((l * (V / A)));
	end
	tmp_2 = tmp;
end
code[c0_, A_, V_, l_] := If[LessEqual[N[(l * V), $MachinePrecision], 0.0], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 2e+291], N[(N[(c0 / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot V \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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

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


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

    1. Initial program 69.7%

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

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

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

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

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

    if 0.0 < (*.f64 V l) < 1.9999999999999999e291

    1. Initial program 83.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{\frac{A}{\color{blue}{V \cdot \ell}}} \]
      2. sqrt-divN/A

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e291 < (*.f64 V l)

    1. Initial program 46.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{\frac{A}{\color{blue}{V \cdot \ell}}} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 63.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 3.1 \cdot 10^{-298}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (c0 A V l)
 :precision binary64
 (if (<= l 3.1e-298)
   (* c0 (/ (sqrt (/ A (- l))) (sqrt (- V))))
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
double code(double c0, double A, double V, double l) {
	double tmp;
	if (l <= 3.1e-298) {
		tmp = c0 * (sqrt((A / -l)) / sqrt(-V));
	} else {
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	}
	return tmp;
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: tmp
    if (l <= 3.1d-298) then
        tmp = c0 * (sqrt((a / -l)) / sqrt(-v))
    else
        tmp = c0 * (sqrt((a / v)) / sqrt(l))
    end if
    code = tmp
end function
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if (l <= 3.1e-298) {
		tmp = c0 * (Math.sqrt((A / -l)) / Math.sqrt(-V));
	} else {
		tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
	}
	return tmp;
}
def code(c0, A, V, l):
	tmp = 0
	if l <= 3.1e-298:
		tmp = c0 * (math.sqrt((A / -l)) / math.sqrt(-V))
	else:
		tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l))
	return tmp
function code(c0, A, V, l)
	tmp = 0.0
	if (l <= 3.1e-298)
		tmp = Float64(c0 * Float64(sqrt(Float64(A / Float64(-l))) / sqrt(Float64(-V))));
	else
		tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l)));
	end
	return tmp
end
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if (l <= 3.1e-298)
		tmp = c0 * (sqrt((A / -l)) / sqrt(-V));
	else
		tmp = c0 * (sqrt((A / V)) / sqrt(l));
	end
	tmp_2 = tmp;
end
code[c0_, A_, V_, l_] := If[LessEqual[l, 3.1e-298], N[(c0 * N[(N[Sqrt[N[(A / (-l)), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.1 \cdot 10^{-298}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 3.1000000000000002e-298

    1. Initial program 70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.1000000000000002e-298 < l

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

Alternative 9: 73.8% accurate, 1.0× speedup?

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

\\
c0 \cdot \sqrt{\frac{A}{\ell \cdot V}}
\end{array}
Derivation
  1. Initial program 73.7%

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

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

Reproduce

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