Average Error: 10.5 → 10.7
Time: 5.4s
Precision: binary64
\[\frac{x - y \cdot z}{t - a \cdot z}\]
\[\frac{\frac{1}{t - z \cdot a}}{\frac{1}{x - z \cdot y}}\]
\frac{x - y \cdot z}{t - a \cdot z}
\frac{\frac{1}{t - z \cdot a}}{\frac{1}{x - z \cdot y}}
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
(FPCore (x y z t a)
 :precision binary64
 (/ (/ 1.0 (- t (* z a))) (/ 1.0 (- x (* z y)))))
double code(double x, double y, double z, double t, double a) {
	return (((double) (x - ((double) (y * z)))) / ((double) (t - ((double) (a * z)))));
}
double code(double x, double y, double z, double t, double a) {
	return ((1.0 / ((double) (t - ((double) (z * a))))) / (1.0 / ((double) (x - ((double) (z * y))))));
}

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.7
Herbie10.7
\[\begin{array}{l} \mathbf{if}\;z < -32113435955957344:\\ \;\;\;\;\frac{x}{t - a \cdot z} - \frac{y}{\frac{t}{z} - a}\\ \mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\ \;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t - a \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - a \cdot z} - \frac{y}{\frac{t}{z} - a}\\ \end{array}\]

Derivation

  1. Initial program Error: 10.5 bits

    \[\frac{x - y \cdot z}{t - a \cdot z}\]
  2. Using strategy rm
  3. Applied clear-numError: 10.9 bits

    \[\leadsto \color{blue}{\frac{1}{\frac{t - a \cdot z}{x - y \cdot z}}}\]
  4. SimplifiedError: 10.9 bits

    \[\leadsto \frac{1}{\color{blue}{\frac{t - z \cdot a}{x - y \cdot z}}}\]
  5. Using strategy rm
  6. Applied div-invError: 10.9 bits

    \[\leadsto \frac{1}{\color{blue}{\left(t - z \cdot a\right) \cdot \frac{1}{x - y \cdot z}}}\]
  7. Applied associate-/r*Error: 10.7 bits

    \[\leadsto \color{blue}{\frac{\frac{1}{t - z \cdot a}}{\frac{1}{x - y \cdot z}}}\]
  8. Final simplificationError: 10.7 bits

    \[\leadsto \frac{\frac{1}{t - z \cdot a}}{\frac{1}{x - z \cdot y}}\]

Reproduce

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