Average Error: 20.0 → 11.6
Time: 4.3s
Precision: binary64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1.564462525671556 \cdot 10^{+129}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -4.7109046042698 \cdot 10^{-313}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2.2340956813037 \cdot 10^{-318}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.3164010340907022 \cdot 10^{+306}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1.564462525671556 \cdot 10^{+129}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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

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

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

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

\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.564462525671556e+129)
   (* c0 (sqrt (/ (/ A V) l)))
   (if (<= (* V l) -4.7109046042698e-313)
     (* c0 (sqrt (/ A (* V l))))
     (if (<= (* V l) 2.2340956813037e-318)
       (* c0 (/ (sqrt (/ A V)) (sqrt l)))
       (if (<= (* V l) 1.3164010340907022e+306)
         (* c0 (/ (sqrt A) (sqrt (* V l))))
         (* c0 (sqrt (* (/ 1.0 V) (/ A l)))))))))
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.564462525671556e+129) {
		tmp = c0 * sqrt((A / V) / l);
	} else if ((V * l) <= -4.7109046042698e-313) {
		tmp = c0 * sqrt(A / (V * l));
	} else if ((V * l) <= 2.2340956813037e-318) {
		tmp = c0 * (sqrt(A / V) / sqrt(l));
	} else if ((V * l) <= 1.3164010340907022e+306) {
		tmp = c0 * (sqrt(A) / sqrt(V * l));
	} else {
		tmp = c0 * sqrt((1.0 / V) * (A / l));
	}
	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 5 regimes
  2. if (*.f64 V l) < -1.564462525671556e129

    1. Initial program 25.6

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied associate-/r*_binary64_104520.0

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

    if -1.564462525671556e129 < (*.f64 V l) < -4.71090460427e-313

    1. Initial program 8.8

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

    if -4.71090460427e-313 < (*.f64 V l) < 2.2340957e-318

    1. Initial program 63.0

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

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

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

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

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

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

    if 2.2340957e-318 < (*.f64 V l) < 1.31640103409070217e306

    1. Initial program 10.8

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

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

    if 1.31640103409070217e306 < (*.f64 V l)

    1. Initial program 42.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1.564462525671556 \cdot 10^{+129}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -4.7109046042698 \cdot 10^{-313}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2.2340956813037 \cdot 10^{-318}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.3164010340907022 \cdot 10^{+306}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \end{array}\]

Reproduce

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