Average Error: 11.2 → 3.6
Time: 4.0s
Precision: binary64
\[\]
\[\]
double code(double a1, double a2, double b1, double b2) {
	return ((double) (((double) (a1 * a2)) / ((double) (b1 * b2))));
}
double code(double a1, double a2, double b1, double b2) {
	double VAR;
	if ((((double) (((double) (a1 * a2)) / ((double) (b1 * b2)))) <= -3.4458051706479055e+93)) {
		VAR = ((double) (a1 / ((double) (b1 * ((double) (b2 / a2))))));
	} else {
		double VAR_1;
		if (((((double) (((double) (a1 * a2)) / ((double) (b1 * b2)))) <= -3.771821867504267e-309) || (!(((double) (((double) (a1 * a2)) / ((double) (b1 * b2)))) <= -0.0) && (((double) (((double) (a1 * a2)) / ((double) (b1 * b2)))) <= 1.0362765352938803e+307)))) {
			VAR_1 = ((double) (((double) (a1 * a2)) / ((double) (b1 * b2))));
		} else {
			VAR_1 = ((double) (1.0 / ((double) (((double) (b2 / a1)) * ((double) (b1 / a2))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.2
Target11.2
Herbie3.6
\[\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -3.4458051706479055e93

    1. Initial program 18.9

      \[\]
    2. Using strategy rm
    3. Applied associate-/l*16.2

      \[\leadsto \]
    4. Simplified16.3

      \[\leadsto \]

    if -3.4458051706479055e93 < (/ (* a1 a2) (* b1 b2)) < -3.771821867504267e-309 or -0.0 < (/ (* a1 a2) (* b1 b2)) < 1.0362765352938803e307

    1. Initial program 0.7

      \[\]

    if -3.771821867504267e-309 < (/ (* a1 a2) (* b1 b2)) < -0.0 or 1.0362765352938803e307 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 22.2

      \[\]
    2. Using strategy rm
    3. Applied clear-num22.4

      \[\leadsto \]
    4. Simplified14.0

      \[\leadsto \]
    5. Using strategy rm
    6. Applied *-un-lft-identity14.0

      \[\leadsto \]
    7. Applied times-frac6.0

      \[\leadsto \]
    8. Applied associate-*r*3.3

      \[\leadsto \]
    9. Simplified3.3

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.6

    \[\leadsto \]

Reproduce

herbie shell --seed 2020191 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"
  :precision binary64

  :herbie-target
  (* (/ a1 b1) (/ a2 b2))

  (/ (* a1 a2) (* b1 b2)))