Average Error: 16.8 → 8.7
Time: 2.5m
Precision: 64
Internal Precision: 1920
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \le -5.630417899394863 \cdot 10^{-287}:\\ \;\;\;\;\left(x + y\right) - \frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{\frac{\frac{a - t}{y}}{\sqrt[3]{z - t}}}\\ \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \le 7.38922058035238 \cdot 10^{-171}:\\ \;\;\;\;\frac{z \cdot y}{t} + x\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) - \frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{\frac{\frac{a - t}{y}}{\sqrt[3]{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

Target

Original16.8
Target8.9
Herbie8.7
\[\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 3 regimes
  2. if (- (+ x y) (/ (* (- z t) y) (- a t))) < -5.630417899394863e-287

    1. Initial program 12.7

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

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{z - t}{\frac{a - t}{y}}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt7.7

      \[\leadsto \left(x + y\right) - \frac{\color{blue}{\left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right) \cdot \sqrt[3]{z - t}}}{\frac{a - t}{y}}\]
    6. Applied associate-/l*7.7

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{\frac{\frac{a - t}{y}}{\sqrt[3]{z - t}}}}\]

    if -5.630417899394863e-287 < (- (+ x y) (/ (* (- z t) y) (- a t))) < 7.38922058035238e-171

    1. Initial program 54.6

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Taylor expanded around inf 16.5

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

    if 7.38922058035238e-171 < (- (+ x y) (/ (* (- z t) y) (- a t)))

    1. Initial program 12.9

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

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{z - t}{\frac{a - t}{y}}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt8.2

      \[\leadsto \left(x + y\right) - \frac{\color{blue}{\left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right) \cdot \sqrt[3]{z - t}}}{\frac{a - t}{y}}\]
    6. Applied associate-/l*8.2

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

Runtime

Time bar (total: 2.5m)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)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"

  :herbie-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))))