Average Error: 7.5 → 1.9
Time: 6.2s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t, double a) {
	return ((double) (((double) (((double) (x * y)) - ((double) (z * t)))) / a));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((((double) (((double) (x * y)) - ((double) (z * t)))) <= -7.052992131420737e+82) || !(((double) (((double) (x * y)) - ((double) (z * t)))) <= 1.7328573753956352e+179))) {
		VAR = ((double) (((double) (x * ((double) (y / a)))) - ((double) (z * ((double) (t / a))))));
	} else {
		VAR = ((double) (((double) (((double) (x * y)) - ((double) (z * t)))) * ((double) (1.0 / a))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.5
Target5.8
Herbie1.9
\[\]

Derivation

  1. Split input into 2 regimes
  2. if (- (* x y) (* z t)) < -7.05299213142073739e82 or 1.73285737539563518e179 < (- (* x y) (* z t))

    1. Initial program 18.5

      \[\]
    2. Using strategy rm
    3. Applied div-sub18.5

      \[\leadsto \]
    4. Simplified12.0

      \[\leadsto \]
    5. Simplified3.4

      \[\leadsto \]

    if -7.05299213142073739e82 < (- (* x y) (* z t)) < 1.73285737539563518e179

    1. Initial program 0.9

      \[\]
    2. Using strategy rm
    3. Applied div-inv1.0

      \[\leadsto \]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.9

    \[\leadsto \]

Reproduce

herbie shell --seed 2020191 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

  :herbie-target
  (if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

  (/ (- (* x y) (* z t)) a))