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

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
Herbie3.0
\[\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 10.5

    \[\frac{x - y \cdot z}{t - a \cdot z}\]
  2. Using strategy rm
  3. Applied div-sub_binary64_1952010.5

    \[\leadsto \color{blue}{\frac{x}{t - a \cdot z} - \frac{y \cdot z}{t - a \cdot z}}\]
  4. Simplified10.5

    \[\leadsto \color{blue}{\frac{x}{t - z \cdot a}} - \frac{y \cdot z}{t - a \cdot z}\]
  5. Simplified10.5

    \[\leadsto \frac{x}{t - z \cdot a} - \color{blue}{\frac{y \cdot z}{t - z \cdot a}}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity_binary64_1951510.5

    \[\leadsto \frac{x}{t - z \cdot a} - \frac{y \cdot z}{\color{blue}{1 \cdot \left(t - z \cdot a\right)}}\]
  8. Applied times-frac_binary64_195217.8

    \[\leadsto \frac{x}{t - z \cdot a} - \color{blue}{\frac{y}{1} \cdot \frac{z}{t - z \cdot a}}\]
  9. Simplified7.8

    \[\leadsto \frac{x}{t - z \cdot a} - \color{blue}{y} \cdot \frac{z}{t - z \cdot a}\]
  10. Taylor expanded around 0 10.5

    \[\leadsto \frac{x}{t - z \cdot a} - \color{blue}{\frac{z \cdot y}{t - a \cdot z}}\]
  11. Simplified3.0

    \[\leadsto \frac{x}{t - z \cdot a} - \color{blue}{\frac{y}{\frac{t}{z} - a}}\]
  12. Final simplification3.0

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

Reproduce

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