Average Error: 15.9 → 13.3
Time: 2.4m
Precision: 64
Internal Precision: 384
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
\[\begin{array}{l} \mathbf{if}\;t \le -3.97056359992514 \cdot 10^{+146}:\\ \;\;\;\;\frac{1}{\frac{\frac{b}{\frac{t}{y}} + \left(1.0 + a\right)}{x + y \cdot \frac{z}{t}}}\\ \mathbf{if}\;t \le 2.719931656851136 \cdot 10^{+86}:\\ \;\;\;\;\frac{x + \left(y \cdot z\right) \cdot \frac{1}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{b}{\frac{t}{y}} + \left(1.0 + a\right)}{x + y \cdot \frac{z}{t}}}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Target

Original15.9
Target13.0
Herbie13.3
\[\begin{array}{l} \mathbf{if}\;t \lt -1.3659085366310088 \cdot 10^{-271}:\\ \;\;\;\;1 \cdot \left(\left(x + \frac{y}{t} \cdot z\right) \cdot \frac{1}{\left(a + 1.0\right) + \frac{y}{t} \cdot b}\right)\\ \mathbf{if}\;t \lt 3.036967103737246 \cdot 10^{-130}:\\ \;\;\;\;\frac{z}{b}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\left(x + \frac{y}{t} \cdot z\right) \cdot \frac{1}{\left(a + 1.0\right) + \frac{y}{t} \cdot b}\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -3.97056359992514e+146 or 2.719931656851136e+86 < t

    1. Initial program 11.4

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
    2. Using strategy rm
    3. Applied div-inv11.4

      \[\leadsto \frac{x + \color{blue}{\left(y \cdot z\right) \cdot \frac{1}{t}}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
    4. Using strategy rm
    5. Applied clear-num11.7

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(a + 1.0\right) + \frac{y \cdot b}{t}}{x + \left(y \cdot z\right) \cdot \frac{1}{t}}}}\]
    6. Applied simplify2.9

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{b}{\frac{t}{y}} + \left(1.0 + a\right)}{x + y \cdot \frac{z}{t}}}}\]

    if -3.97056359992514e+146 < t < 2.719931656851136e+86

    1. Initial program 18.0

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
    2. Using strategy rm
    3. Applied div-inv18.1

      \[\leadsto \frac{x + \color{blue}{\left(y \cdot z\right) \cdot \frac{1}{t}}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 2.4m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y z t a b)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"

  :herbie-target
  (if (< t -1.3659085366310088e-271) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1.0) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1.0) (* (/ y t) b)))))))

  (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))