Average Error: 1.6 → 0.4
Time: 21.0s
Precision: 64
Internal Precision: 384
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\left(x + 4\right) - x \cdot z \le -2.0353217661578766 \cdot 10^{+67}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{if}\;\left(x + 4\right) - x \cdot z \le 4.3201663597337426 \cdot 10^{+286}:\\ \;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 3 regimes
  2. if (- (+ x 4) (* x z)) < -2.0353217661578766e+67

    1. Initial program 2.3

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Taylor expanded around 0 8.7

      \[\leadsto \left|\color{blue}{\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{z \cdot x}{y}}\right|\]
    3. Applied simplify1.8

      \[\leadsto \color{blue}{\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{\frac{y}{z}}\right|}\]

    if -2.0353217661578766e+67 < (- (+ x 4) (* x z)) < 4.3201663597337426e+286

    1. Initial program 1.4

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied associate-*l/0.1

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}}\right|\]
    4. Applied sub-div0.1

      \[\leadsto \left|\color{blue}{\frac{\left(x + 4\right) - x \cdot z}{y}}\right|\]

    if 4.3201663597337426e+286 < (- (+ x 4) (* x z))

    1. Initial program 0.2

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied div-inv0.3

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\left(x \cdot \frac{1}{y}\right)} \cdot z\right|\]
    4. Applied associate-*l*0.3

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{x \cdot \left(\frac{1}{y} \cdot z\right)}\right|\]
    5. Applied simplify0.2

      \[\leadsto \left|\frac{x + 4}{y} - x \cdot \color{blue}{\frac{z}{y}}\right|\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 21.0s)Debug logProfile

herbie shell --seed '#(1070258749 1877548225 2229079127 1588002776 3179087814 1886870650)' +o rules:numerics
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))