Average Error: 10.5 → 1.8
Time: 6.6s
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 <= -2.8555953093468573e-08) || !(z <= 2.4115471070274707e-100))) {
		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) (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

Original10.5
Target1.8
Herbie1.8
\[\]

Derivation

  1. Split input into 2 regimes
  2. if z < -2.8555953093468573e-8 or 2.41154710702747068e-100 < z

    1. Initial program 17.8

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

      \[\leadsto \]
    4. Simplified17.8

      \[\leadsto \]
    5. Simplified2.9

      \[\leadsto \]

    if -2.8555953093468573e-8 < z < 2.41154710702747068e-100

    1. Initial program 0.1

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020179 
(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))))