Average Error: 18.8 → 13.1
Time: 3.2s
Precision: binary64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1.8224640885465417 \cdot 10^{+236}:\\ \;\;\;\;\frac{\sqrt{\frac{A}{\ell}} \cdot c0}{\sqrt{V}}\\ \mathbf{elif}\;V \cdot \ell \leq -1.1485669237723498 \cdot 10^{-254}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{\sqrt{\frac{A}{\ell}} \cdot c0}{\sqrt{V}}\\ \mathbf{elif}\;V \cdot \ell \leq 7.596503550601429 \cdot 10^{+267}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{\ell} \cdot \frac{1}{V}}\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1.8224640885465417 \cdot 10^{+236}:\\
\;\;\;\;\frac{\sqrt{\frac{A}{\ell}} \cdot c0}{\sqrt{V}}\\

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

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

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

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

\end{array}
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) -1.8224640885465417e+236)
   (/ (* (sqrt (/ A l)) c0) (sqrt V))
   (if (<= (* V l) -1.1485669237723498e-254)
     (* c0 (sqrt (* A (/ 1.0 (* V l)))))
     (if (<= (* V l) 0.0)
       (/ (* (sqrt (/ A l)) c0) (sqrt V))
       (if (<= (* V l) 7.596503550601429e+267)
         (* c0 (/ (sqrt A) (sqrt (* V l))))
         (* c0 (sqrt (* (/ A l) (/ 1.0 V)))))))))
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) <= -1.8224640885465417e+236) {
		tmp = (sqrt(A / l) * c0) / sqrt(V);
	} else if ((V * l) <= -1.1485669237723498e-254) {
		tmp = c0 * sqrt(A * (1.0 / (V * l)));
	} else if ((V * l) <= 0.0) {
		tmp = (sqrt(A / l) * c0) / sqrt(V);
	} else if ((V * l) <= 7.596503550601429e+267) {
		tmp = c0 * (sqrt(A) / sqrt(V * l));
	} else {
		tmp = c0 * sqrt((A / l) * (1.0 / V));
	}
	return tmp;
}

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 4 regimes
  2. if (*.f64 V l) < -1.82246408854654173e236 or -1.14856692377234979e-254 < (*.f64 V l) < 0.0

    1. Initial program 43.5

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary6443.5

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}}\]
    5. Using strategy rm
    6. Applied associate-*l/_binary6426.5

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

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

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

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

    if -1.82246408854654173e236 < (*.f64 V l) < -1.14856692377234979e-254

    1. Initial program 8.4

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied div-inv_binary648.4

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

    if 0.0 < (*.f64 V l) < 7.5965035506014294e267

    1. Initial program 9.6

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied sqrt-div_binary640.8

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

    if 7.5965035506014294e267 < (*.f64 V l)

    1. Initial program 37.4

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary6437.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1.8224640885465417 \cdot 10^{+236}:\\ \;\;\;\;\frac{\sqrt{\frac{A}{\ell}} \cdot c0}{\sqrt{V}}\\ \mathbf{elif}\;V \cdot \ell \leq -1.1485669237723498 \cdot 10^{-254}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{\sqrt{\frac{A}{\ell}} \cdot c0}{\sqrt{V}}\\ \mathbf{elif}\;V \cdot \ell \leq 7.596503550601429 \cdot 10^{+267}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{\ell} \cdot \frac{1}{V}}\\ \end{array}\]

Reproduce

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