Average Error: 17.0 → 7.4
Time: 33.8s
Precision: 64
Internal precision: 128
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.4870814148066594 \cdot 10^{+93}:\\ \;\;\;\;\frac{z \cdot y}{t} + x\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - \left(z - t\right) \cdot \frac{y}{a - t}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original17.0
Comparison9.6
Herbie7.4
\[ \begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.3664970889390727 \cdot 10^{-07}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt 1.4754293444577233 \cdot 10^{-239}:\\ \;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \end{array} \]

Derivation

  1. Split input into 2 regimes.
  2. if t < -1.4870814148066594e+93

    1. Initial program 32.0

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Applied taylor 5.9

      \[\leadsto \frac{z \cdot y}{t} + x\]
    3. Taylor expanded around inf 5.9

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

    if -1.4870814148066594e+93 < t

    1. Initial program 13.5

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Using strategy rm
    3. Applied associate-/l* 9.8

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{z - t}{\frac{a - t}{y}}}\]
    4. Using strategy rm
    5. Applied associate--l+ 7.6

      \[\leadsto \color{blue}{x + \left(y - \frac{z - t}{\frac{a - t}{y}}\right)}\]
    6. Using strategy rm
    7. Applied div-inv 8.2

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

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

Runtime

Time bar (total: 33.8s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1106470522 307320770 2981921710 3117656402 3903939474 1142827929)'
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"

  :target
  (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-07) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y))))

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