Average Error: 19.1 → 13.8
Time: 8.1s
Precision: binary64
\[\]
\[\]
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 ((A / (V * l)) <= 3.5885075091003e-311) {
		tmp = c0 * sqrt((A / V) / l);
	} else if ((A / (V * l)) <= 4.541364065875616e+302) {
		tmp = sqrt(sqrt(A / (V * l))) * (c0 * sqrt(sqrt(A / (V * l))));
	} else {
		tmp = c0 * (sqrt((cbrt(A) * cbrt(A)) / V) * sqrt(cbrt(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 3 regimes
  2. if (/ A (* V l)) < 3.58850750910027e-311

    1. Initial program 40.3

      \[\]
    2. Using strategy rm
    3. Applied associate-/r*30.2

      \[\leadsto \]

    if 3.58850750910027e-311 < (/ A (* V l)) < 4.54136406587561631e302

    1. Initial program 0.5

      \[\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.5

      \[\leadsto \]
    4. Applied sqrt-prod0.8

      \[\leadsto \]
    5. Applied associate-*r*0.8

      \[\leadsto \]
    6. Simplified0.8

      \[\leadsto \]

    if 4.54136406587561631e302 < (/ A (* V l))

    1. Initial program 62.7

      \[\]
    2. Using strategy rm
    3. Applied add-cube-cbrt62.7

      \[\leadsto \]
    4. Applied times-frac49.7

      \[\leadsto \]
    5. Applied sqrt-prod42.3

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification13.8

    \[\leadsto \]

Reproduce

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