Average Error: 10.8 → 2.8
Time: 3.5s
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)))) <= -8.100632801906693e+206)) {
		VAR = ((double) (((double) (a1 / b1)) * ((double) (a2 / b2))));
	} else {
		double VAR_1;
		if (((((double) (((double) (a1 * a2)) / ((double) (b1 * b2)))) <= -1.308580370345572e-302) || (!(((double) (((double) (a1 * a2)) / ((double) (b1 * b2)))) <= 0.0) && (((double) (((double) (a1 * a2)) / ((double) (b1 * b2)))) <= 1.9171923786035137e+306)))) {
			VAR_1 = ((double) (((double) (a1 * a2)) / ((double) (b1 * b2))));
		} else {
			VAR_1 = ((double) (((double) (a2 / b1)) * ((double) (a1 / b2))));
		}
		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

Original10.8
Target10.6
Herbie2.8
\[\]

Derivation

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

    1. Initial program 29.8

      \[\]
    2. Using strategy rm
    3. Applied times-frac17.4

      \[\leadsto \]

    if -8.1006328019066931e206 < (/ (* a1 a2) (* b1 b2)) < -1.30858037034557193e-302 or 0.0 < (/ (* a1 a2) (* b1 b2)) < 1.91719237860351367e306

    1. Initial program 0.8

      \[\]

    if -1.30858037034557193e-302 < (/ (* a1 a2) (* b1 b2)) < 0.0 or 1.91719237860351367e306 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 21.9

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

      \[\leadsto \]
    4. Simplified14.2

      \[\leadsto \]
    5. Using strategy rm
    6. Applied add-cube-cbrt14.2

      \[\leadsto \]
    7. Applied times-frac13.8

      \[\leadsto \]
    8. Simplified13.8

      \[\leadsto \]
    9. Simplified5.6

      \[\leadsto \]
    10. Taylor expanded around 0 21.9

      \[\leadsto \]
    11. Simplified3.1

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

    \[\leadsto \]

Reproduce

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

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

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