Average Error: 10.2 → 1.5
Time: 5.3s
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.2583693790391414e-48) || !(z <= 10.275809148984232))) {
		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.2
Target1.7
Herbie1.5
\[\]

Derivation

  1. Split input into 2 regimes
  2. if z < -1.25836937903914137e-48 or 10.2758091489842318 < z

    1. Initial program 19.2

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

      \[\leadsto \]
    4. Simplified19.2

      \[\leadsto \]
    5. Simplified11.8

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

      \[\leadsto \]
    8. Simplified2.8

      \[\leadsto \]

    if -1.25836937903914137e-48 < z < 10.2758091489842318

    1. Initial program 0.1

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

    \[\leadsto \]

Reproduce

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