Average Error: 26.8 → 17.5
Time: 34.6s
Precision: binary64
\[\]
\[\]
double code(double d, double h, double l, double M, double D) {
	return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if ((l <= 1.0097243451344419e-288) || !(l <= 8.16851537488987e-179)) {
		tmp = (pow((cbrt(d) * cbrt(d)), (1.0 / 2.0)) * (pow(cbrt(cbrt(d) * cbrt(d)), (1.0 / 2.0)) * pow((cbrt(cbrt(d)) / h), (1.0 / 2.0)))) * ((pow((1.0 / (cbrt(l) * cbrt(l))), (1.0 / 2.0)) * pow((d / cbrt(l)), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (d * 2.0)), 2.0)) * (h / l))));
	} else {
		tmp = 1.0 * ((pow(1.0, 1.0) * pow(d, 1.0)) * pow((1.0 / (pow((pow(1.0, 1.0) * pow(l, 1.0)), 1.0) * pow((pow(1.0, 1.0) * pow(h, 1.0)), 1.0))), 0.5));
	}
	return tmp;
}

Error

Bits error versus d

Bits error versus h

Bits error versus l

Bits error versus M

Bits error versus D

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if l < 1.00972434513444187e-288 or 8.1685153748898703e-179 < l

    1. Initial program 26.2

      \[\]
    2. Using strategy rm
    3. Applied add-cube-cbrt26.4

      \[\leadsto \]
    4. Applied *-un-lft-identity26.4

      \[\leadsto \]
    5. Applied times-frac26.4

      \[\leadsto \]
    6. Applied unpow-prod-down22.3

      \[\leadsto \]
    7. Using strategy rm
    8. Applied *-un-lft-identity22.3

      \[\leadsto \]
    9. Applied add-cube-cbrt22.5

      \[\leadsto \]
    10. Applied times-frac22.5

      \[\leadsto \]
    11. Applied unpow-prod-down17.8

      \[\leadsto \]
    12. Simplified17.8

      \[\leadsto \]
    13. Using strategy rm
    14. Applied *-un-lft-identity17.8

      \[\leadsto \]
    15. Applied add-cube-cbrt17.8

      \[\leadsto \]
    16. Applied cbrt-prod17.9

      \[\leadsto \]
    17. Applied times-frac17.9

      \[\leadsto \]
    18. Applied unpow-prod-down16.9

      \[\leadsto \]
    19. Simplified16.9

      \[\leadsto \]
    20. Using strategy rm
    21. Applied associate-*l*16.4

      \[\leadsto \]

    if 1.00972434513444187e-288 < l < 8.1685153748898703e-179

    1. Initial program 37.6

      \[\]
    2. Taylor expanded around 0 38.3

      \[\leadsto \]
    3. Simplified35.8

      \[\leadsto \]
  3. Recombined 2 regimes into one program.
  4. Final simplification17.5

    \[\leadsto \]

Reproduce

herbie shell --seed 2020338 
(FPCore (d h l M D)
  :name "Henrywood and Agarwal, Equation (12)"
  :precision binary64
  (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))