Average Error: 19.4 → 5.5
Time: 7.0s
Precision: binary64
\[ \begin{array}{c}[V, l] = \mathsf{sort}([V, l])\\ \end{array} \]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \left(\frac{1}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\right)\\ \mathbf{elif}\;V \cdot \ell \leq -4.4 \cdot 10^{-323}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{\sqrt{-A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 5.2177734963 \cdot 10^{-314}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.3992612250695144 \cdot 10^{+304}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) (- INFINITY))
   (* c0 (* (/ 1.0 (sqrt l)) (sqrt (/ A V))))
   (if (<= (* V l) -4.4e-323)
     (/ c0 (/ (sqrt (* V (- l))) (sqrt (- A))))
     (if (<= (* V l) 5.2177734963e-314)
       (* c0 (/ 1.0 (* (sqrt l) (sqrt (/ V A)))))
       (if (<= (* V l) 1.3992612250695144e+304)
         (* c0 (/ (sqrt A) (sqrt (* V l))))
         (/ c0 (sqrt (* V (/ l A)))))))))
double code(double c0, double A, double V, double l) {
	return c0 * sqrt((A / (V * l)));
}
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 * ((1.0 / sqrt(l)) * sqrt((A / V)));
	} else if ((V * l) <= -4.4e-323) {
		tmp = c0 / (sqrt((V * -l)) / sqrt(-A));
	} else if ((V * l) <= 5.2177734963e-314) {
		tmp = c0 * (1.0 / (sqrt(l) * sqrt((V / A))));
	} else if ((V * l) <= 1.3992612250695144e+304) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 / sqrt((V * (l / A)));
	}
	return tmp;
}
public static double code(double c0, double A, double V, double l) {
	return c0 * Math.sqrt((A / (V * l)));
}
public static double code(double c0, double A, double V, double l) {
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = c0 * ((1.0 / Math.sqrt(l)) * Math.sqrt((A / V)));
	} else if ((V * l) <= -4.4e-323) {
		tmp = c0 / (Math.sqrt((V * -l)) / Math.sqrt(-A));
	} else if ((V * l) <= 5.2177734963e-314) {
		tmp = c0 * (1.0 / (Math.sqrt(l) * Math.sqrt((V / A))));
	} else if ((V * l) <= 1.3992612250695144e+304) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 / Math.sqrt((V * (l / A)));
	}
	return tmp;
}
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
def code(c0, A, V, l):
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = c0 * ((1.0 / math.sqrt(l)) * math.sqrt((A / V)))
	elif (V * l) <= -4.4e-323:
		tmp = c0 / (math.sqrt((V * -l)) / math.sqrt(-A))
	elif (V * l) <= 5.2177734963e-314:
		tmp = c0 * (1.0 / (math.sqrt(l) * math.sqrt((V / A))))
	elif (V * l) <= 1.3992612250695144e+304:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 / math.sqrt((V * (l / A)))
	return tmp
function code(c0, A, V, l)
	return Float64(c0 * sqrt(Float64(A / Float64(V * l))))
end
function code(c0, A, V, l)
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = Float64(c0 * Float64(Float64(1.0 / sqrt(l)) * sqrt(Float64(A / V))));
	elseif (Float64(V * l) <= -4.4e-323)
		tmp = Float64(c0 / Float64(sqrt(Float64(V * Float64(-l))) / sqrt(Float64(-A))));
	elseif (Float64(V * l) <= 5.2177734963e-314)
		tmp = Float64(c0 * Float64(1.0 / Float64(sqrt(l) * sqrt(Float64(V / A)))));
	elseif (Float64(V * l) <= 1.3992612250695144e+304)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A))));
	end
	return tmp
end
function tmp = code(c0, A, V, l)
	tmp = c0 * sqrt((A / (V * l)));
end
function tmp_2 = code(c0, A, V, l)
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = c0 * ((1.0 / sqrt(l)) * sqrt((A / V)));
	elseif ((V * l) <= -4.4e-323)
		tmp = c0 / (sqrt((V * -l)) / sqrt(-A));
	elseif ((V * l) <= 5.2177734963e-314)
		tmp = c0 * (1.0 / (sqrt(l) * sqrt((V / A))));
	elseif ((V * l) <= 1.3992612250695144e+304)
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 / sqrt((V * (l / A)));
	end
	tmp_2 = tmp;
end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 * N[(N[(1.0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -4.4e-323], N[(c0 / N[(N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-A)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5.2177734963e-314], N[(c0 * N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1.3992612250695144e+304], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \left(\frac{1}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\right)\\

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

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

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

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


\end{array}

Error

Bits error versus c0

Bits error versus A

Bits error versus V

Bits error versus l

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 5 regimes
  2. if (*.f64 V l) < -inf.0

    1. Initial program 44.0

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr24.5

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

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

    if -inf.0 < (*.f64 V l) < -4.44659e-323

    1. Initial program 10.3

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr16.5

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

      \[\leadsto \color{blue}{\frac{\frac{c0}{{\left(V \cdot \frac{\ell}{A}\right)}^{0.25}}}{{\left(V \cdot \frac{\ell}{A}\right)}^{0.25}}} \]
    4. Applied egg-rr10.3

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

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

    if -4.44659e-323 < (*.f64 V l) < 5.21777349631e-314

    1. Initial program 63.3

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr35.9

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

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

    if 5.21777349631e-314 < (*.f64 V l) < 1.3992612250695144e304

    1. Initial program 10.1

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr0.4

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

    if 1.3992612250695144e304 < (*.f64 V l)

    1. Initial program 39.1

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr24.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \left(\frac{1}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\right)\\ \mathbf{elif}\;V \cdot \ell \leq -4.4 \cdot 10^{-323}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{\sqrt{-A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 5.2177734963 \cdot 10^{-314}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.3992612250695144 \cdot 10^{+304}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]

Reproduce

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