Average Error: 10.6 → 1.9
Time: 24.9s
Precision: 64
Internal precision: 128
\[\frac{x - y \cdot z}{t - a \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.5926369593026417 \cdot 10^{+19}:\\ \;\;\;\;\frac{x}{t - a \cdot z} - \frac{y}{\frac{t}{z} - a}\\ \mathbf{if}\;z \le 4.0102291809654423 \cdot 10^{-147}:\\ \;\;\;\;\frac{x - y \cdot z}{t - a \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - a \cdot z} - \frac{y}{\frac{t}{z} - a}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original10.6
Comparison1.8
Herbie1.9
\[ \begin{array}{l} \mathbf{if}\;z \lt -32113435955957344.0:\\ \;\;\;\;\frac{x}{t - a \cdot z} - \frac{y}{\frac{t}{z} - a}\\ \mathbf{if}\;z \lt 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. Split input into 2 regimes.
  2. if z < -2.5926369593026417e+19 or 4.0102291809654423e-147 < z

    1. Initial program 17.5

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

      \[\leadsto \color{blue}{\frac{x}{t - a \cdot z} - \frac{y \cdot z}{t - a \cdot z}}\]
    4. Applied simplify 3.1

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

    if -2.5926369593026417e+19 < z < 4.0102291809654423e-147

    1. Initial program 0.2

      \[\frac{x - y \cdot z}{t - a \cdot z}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 24.9s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(795767902 2781468165 2684183434 2168953841 2127699199 2953697635)'
(FPCore (x y z t a)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"

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

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