Average Error: 19.2 → 8.0
Time: 11.7s
Precision: binary64
\[[V, l]=\mathsf{sort}([V, l])\]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -9.508350842983625 \cdot 10^{+299}:\\ \;\;\;\;c0 \cdot {\left(e^{0.25 \cdot \left(\log \left(\frac{A}{V}\right) - \log \ell\right)}\right)}^{2}\\ \mathbf{elif}\;V \cdot \ell \leq -8.825750467531032 \cdot 10^{-304}:\\ \;\;\;\;c0 \cdot {\left(e^{0.25 \cdot \left(\log \left(\frac{{\left(\sqrt[3]{-1}\right)}^{3}}{V \cdot \ell}\right) - \log \left(\frac{-1}{A}\right)\right)}\right)}^{2}\\ \mathbf{elif}\;V \cdot \ell \leq 2.96 \cdot 10^{-322} \lor \neg \left(V \cdot \ell \leq 1.794321740595174 \cdot 10^{+302}\right):\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -9.508350842983625 \cdot 10^{+299}:\\
\;\;\;\;c0 \cdot {\left(e^{0.25 \cdot \left(\log \left(\frac{A}{V}\right) - \log \ell\right)}\right)}^{2}\\

\mathbf{elif}\;V \cdot \ell \leq -8.825750467531032 \cdot 10^{-304}:\\
\;\;\;\;c0 \cdot {\left(e^{0.25 \cdot \left(\log \left(\frac{{\left(\sqrt[3]{-1}\right)}^{3}}{V \cdot \ell}\right) - \log \left(\frac{-1}{A}\right)\right)}\right)}^{2}\\

\mathbf{elif}\;V \cdot \ell \leq 2.96 \cdot 10^{-322} \lor \neg \left(V \cdot \ell \leq 1.794321740595174 \cdot 10^{+302}\right):\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \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) -9.508350842983625e+299)
   (* c0 (pow (exp (* 0.25 (- (log (/ A V)) (log l)))) 2.0))
   (if (<= (* V l) -8.825750467531032e-304)
     (*
      c0
      (pow
       (exp
        (* 0.25 (- (log (/ (pow (cbrt -1.0) 3.0) (* V l))) (log (/ -1.0 A)))))
       2.0))
     (if (or (<= (* V l) 2.96e-322) (not (<= (* V l) 1.794321740595174e+302)))
       (* c0 (sqrt (/ (/ A l) V)))
       (* c0 (/ (sqrt A) (sqrt (* V 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) <= -9.508350842983625e+299) {
		tmp = c0 * pow(exp(0.25 * (log(A / V) - log(l))), 2.0);
	} else if ((V * l) <= -8.825750467531032e-304) {
		tmp = c0 * pow(exp(0.25 * (log(pow(cbrt(-1.0), 3.0) / (V * l)) - log(-1.0 / A))), 2.0);
	} else if (((V * l) <= 2.96e-322) || !((V * l) <= 1.794321740595174e+302)) {
		tmp = c0 * sqrt((A / l) / V);
	} else {
		tmp = c0 * (sqrt(A) / sqrt(V * 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 4 regimes
  2. if (*.f64 V l) < -9.5083508429836249e299

    1. Initial program 40.8

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied add-cube-cbrt_binary6440.9

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\left(\sqrt[3]{A} \cdot \sqrt[3]{A}\right) \cdot \sqrt[3]{A}}}{V \cdot \ell}} \]
    3. Applied times-frac_binary6422.9

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}} \]
    4. Applied add-cube-cbrt_binary6423.0

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{A}} \cdot \sqrt[3]{\sqrt[3]{A}}\right) \cdot \sqrt[3]{\sqrt[3]{A}}\right)} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}} \]
    5. Applied pow3_binary6423.0

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{{\left(\sqrt[3]{\sqrt[3]{A}}\right)}^{3}} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}} \]
    6. Applied add-sqr-sqrt_binary6423.0

      \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{{\left(\sqrt[3]{\sqrt[3]{A}}\right)}^{3} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}} \cdot \sqrt{\sqrt{\frac{{\left(\sqrt[3]{\sqrt[3]{A}}\right)}^{3} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}}\right)} \]
    7. Applied pow2_binary6423.0

      \[\leadsto c0 \cdot \color{blue}{{\left(\sqrt{\sqrt{\frac{{\left(\sqrt[3]{\sqrt[3]{A}}\right)}^{3} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}}\right)}^{2}} \]
    8. Taylor expanded in l around 0 12.9

      \[\leadsto c0 \cdot {\color{blue}{\left(e^{0.25 \cdot \left(\log \left(\frac{A}{V}\right) - \log \ell\right)}\right)}}^{2} \]

    if -9.5083508429836249e299 < (*.f64 V l) < -8.8257504675310316e-304

    1. Initial program 10.2

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied add-cube-cbrt_binary6410.7

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}} \]
    4. Applied add-cube-cbrt_binary6415.3

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{A}} \cdot \sqrt[3]{\sqrt[3]{A}}\right) \cdot \sqrt[3]{\sqrt[3]{A}}\right)} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}} \]
    5. Applied pow3_binary6415.3

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{{\left(\sqrt[3]{\sqrt[3]{A}}\right)}^{3}} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}} \]
    6. Applied add-sqr-sqrt_binary6415.3

      \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{{\left(\sqrt[3]{\sqrt[3]{A}}\right)}^{3} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}} \cdot \sqrt{\sqrt{\frac{{\left(\sqrt[3]{\sqrt[3]{A}}\right)}^{3} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}}\right)} \]
    7. Applied pow2_binary6415.3

      \[\leadsto c0 \cdot \color{blue}{{\left(\sqrt{\sqrt{\frac{{\left(\sqrt[3]{\sqrt[3]{A}}\right)}^{3} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}}\right)}^{2}} \]
    8. Taylor expanded in A around -inf 5.3

      \[\leadsto c0 \cdot {\color{blue}{\left(e^{0.25 \cdot \left(\log \left(\frac{{\left(\sqrt[3]{-1}\right)}^{3}}{V \cdot \ell}\right) - \log \left(\frac{-1}{A}\right)\right)}\right)}}^{2} \]

    if -8.8257504675310316e-304 < (*.f64 V l) < 2.96439e-322 or 1.794321740595174e302 < (*.f64 V l)

    1. Initial program 51.4

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied add-cube-cbrt_binary6451.4

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\left(\sqrt[3]{A} \cdot \sqrt[3]{A}\right) \cdot \sqrt[3]{A}}}{V \cdot \ell}} \]
    3. Applied times-frac_binary6430.4

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\left(\sqrt[3]{A} \cdot \sqrt[3]{A}\right) \cdot \frac{\sqrt[3]{A}}{\ell}}{V}}} \]
    5. Simplified30.2

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

    if 2.96439e-322 < (*.f64 V l) < 1.794321740595174e302

    1. Initial program 10.7

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied sqrt-div_binary640.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -9.508350842983625 \cdot 10^{+299}:\\ \;\;\;\;c0 \cdot {\left(e^{0.25 \cdot \left(\log \left(\frac{A}{V}\right) - \log \ell\right)}\right)}^{2}\\ \mathbf{elif}\;V \cdot \ell \leq -8.825750467531032 \cdot 10^{-304}:\\ \;\;\;\;c0 \cdot {\left(e^{0.25 \cdot \left(\log \left(\frac{{\left(\sqrt[3]{-1}\right)}^{3}}{V \cdot \ell}\right) - \log \left(\frac{-1}{A}\right)\right)}\right)}^{2}\\ \mathbf{elif}\;V \cdot \ell \leq 2.96 \cdot 10^{-322} \lor \neg \left(V \cdot \ell \leq 1.794321740595174 \cdot 10^{+302}\right):\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]

Reproduce

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