Average Error: 11.3 → 1.9
Time: 4.7s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t, double a) {
	return ((double) (((double) (x - ((double) (y * z)))) / ((double) (t - ((double) (a * z))))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((z <= -1.7409108609623183e+20) || !(z <= 1.787817391526903e-96))) {
		VAR = ((double) (((double) (x / ((double) (t - ((double) (z * a)))))) - ((double) (y / ((double) (((double) (t / z)) - a))))));
	} else {
		VAR = ((double) (((double) (x - ((double) (z * y)))) * ((double) (1.0 / ((double) (t - ((double) (z * 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

Original11.3
Target1.8
Herbie1.9
\[\]

Derivation

  1. Split input into 2 regimes
  2. if z < -174091086096231830000 or 1.787817391526903e-96 < z

    1. Initial program 19.8

      \[\]
    2. Using strategy rm
    3. Applied div-sub19.8

      \[\leadsto \]
    4. Simplified19.8

      \[\leadsto \]
    5. Simplified12.6

      \[\leadsto \]
    6. Using strategy rm
    7. Applied sub-neg12.6

      \[\leadsto \]
    8. Simplified3.0

      \[\leadsto \]

    if -174091086096231830000 < z < 1.787817391526903e-96

    1. Initial program 0.3

      \[\]
    2. Using strategy rm
    3. Applied div-inv0.4

      \[\leadsto \]
    4. Simplified0.4

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020192 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< z -32113435955957344.0) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a)))))

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