Average Error: 1.5 → 0.1
Time: 30.9s
Precision: 64
Internal Precision: 384
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\left|\frac{x + 4}{y} - \frac{x \cdot z}{y}\right| \le 4.4062327616993004 \cdot 10^{+251}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{x \cdot z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} - \frac{x}{y} \cdot z\right) + \frac{x}{y}\right|\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if (fabs (- (/ (+ x 4) y) (/ (* x z) y))) < 4.4062327616993004e+251

    1. Initial program 1.7

      \[\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|\]

    if 4.4062327616993004e+251 < (fabs (- (/ (+ x 4) y) (/ (* x z) y)))

    1. Initial program 0.2

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

      \[\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|\frac{x}{y} \cdot \left(-z\right) + \left(\frac{4}{y} + \frac{x}{y}\right)\right|}\]
    4. Using strategy rm
    5. Applied associate-+r+0.1

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

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

Runtime

Time bar (total: 30.9s)Debug logProfile

herbie shell --seed '#(1070833653 108281690 3330367898 3632331308 3494323072 43156186)' 
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))