Average Error: 1.7 → 0.2
Time: 43.9s
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\left(4 + x\right) - z \cdot x \le -2.3087209457444335 \cdot 10^{+178}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{if}\;\left(4 + x\right) - z \cdot x \le 3.1412149248979447 \cdot 10^{+273}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|(\left(4 + x\right) \cdot \left(\frac{1}{y}\right) + \left(\frac{x}{y} \cdot \left(-z\right)\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) (* x z)) < -2.3087209457444335e+178

    1. Initial program 0.5

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.5

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

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

      \[\leadsto \left|\color{blue}{\left(\frac{x + 4}{y} - \frac{x}{\frac{y}{z}}\right)} + (\left(-z\right) \cdot \left(\frac{x}{y}\right) + \left(z \cdot \frac{x}{y}\right))_*\right|\]
    6. Applied simplify1.2

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

    if -2.3087209457444335e+178 < (- (+ x 4) (* x z)) < 3.1412149248979447e+273

    1. Initial program 1.9

      \[\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 3.1412149248979447e+273 < (- (+ 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|\color{blue}{\left(x + 4\right) \cdot \frac{1}{y}} - \frac{x}{y} \cdot z\right|\]
    4. Applied fma-neg0.3

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\left(4 + x\right) - z \cdot x \le -2.3087209457444335 \cdot 10^{+178}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{if}\;\left(4 + x\right) - z \cdot x \le 3.1412149248979447 \cdot 10^{+273}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|(\left(4 + x\right) \cdot \left(\frac{1}{y}\right) + \left(\frac{x}{y} \cdot \left(-z\right)\right))_*\right|\\ \end{array}}\]

Runtime

Time bar (total: 43.9s)Debug logProfile

herbie shell --seed '#(1072967564 1937075727 894099792 790700740 1036514779 1027793188)' +o rules:numerics
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))