Average Error: 1.7 → 0.4
Time: 21.2s
Precision: 64
Internal Precision: 384
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\frac{x + 4}{y} - \frac{x}{\frac{y}{z}} = -\infty:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{x \cdot z}{y}\right|\\ \mathbf{if}\;\frac{x + 4}{y} - \frac{x}{\frac{y}{z}} \le 4.439362563436184 \cdot 10^{+247}:\\ \;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|(\left(\frac{x}{y}\right) \cdot \left(-z\right) + \left(\frac{4}{y} + \frac{x}{y}\right))_*\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) y) (/ x (/ y z))) < -inf.0

    1. Initial program 0.1

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

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

    if -inf.0 < (- (/ (+ x 4) y) (/ x (/ y z))) < 4.439362563436184e+247

    1. Initial program 1.9

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

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

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

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

    if 4.439362563436184e+247 < (- (/ (+ x 4) y) (/ x (/ y z)))

    1. Initial program 0.1

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

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

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

Runtime

Time bar (total: 21.2s)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' +o rules:numerics
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))