Average Error: 1.7 → 0.3
Time: 10.5s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.3408564370710812 \cdot 10^{-05} \lor \neg \left(x \le 4.419608150381183 \cdot 10^{-92}\right):\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\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 < -1.3408564370710812e-05 or 4.419608150381183e-92 < x

    1. Initial program 0.5

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

      \[\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. Using strategy rm
    6. Applied associate-*l/0.5

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

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

    if -1.3408564370710812e-05 < x < 4.419608150381183e-92

    1. Initial program 2.8

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

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

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{x \cdot \left(\frac{1}{y} \cdot z\right)}\right|\]
    5. Using strategy rm
    6. Applied associate-*l/5.8

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

      \[\leadsto \left|\frac{x + 4}{y} - x \cdot \frac{\color{blue}{z}}{y}\right|\]
    8. Using strategy rm
    9. Applied associate-*r/0.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.3408564370710812 \cdot 10^{-05} \lor \neg \left(x \le 4.419608150381183 \cdot 10^{-92}\right):\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \end{array}\]

Reproduce

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