Average Error: 1.5 → 0.1
Time: 56.9s
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\frac{x + 4}{y} - x \cdot \frac{z}{y} \le -1.1750199255444325 \cdot 10^{+307}:\\ \;\;\;\;\left|\frac{1}{\frac{y}{x + 4}} - \frac{x}{y} \cdot z\right|\\ \mathbf{if}\;\frac{x + 4}{y} - x \cdot \frac{z}{y} \le 1.2585242294646298 \cdot 10^{+60}:\\ \;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{1}{\frac{y}{x + 4}} - \frac{x}{y} \cdot z\right|\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (- (/ (+ x 4) y) (* x (/ z y))) < -1.1750199255444325e+307 or 1.2585242294646298e+60 < (- (/ (+ x 4) y) (* x (/ z y)))

    1. Initial program 0.1

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

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

    if -1.1750199255444325e+307 < (- (/ (+ x 4) y) (* x (/ z y))) < 1.2585242294646298e+60

    1. Initial program 2.1

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

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

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

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

Runtime

Time bar (total: 56.9s)Debug logProfile

herbie shell --seed 2018296 +o rules:numerics
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))