Average Error: 1.6 → 0.5
Time: 17.4s
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -5.500202078890607 \cdot 10^{+30}:\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \left(z \cdot \frac{1}{y}\right)\right|\\ \mathbf{elif}\;x \le 5.839078003719052 \cdot 10^{-139}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \left(z \cdot \frac{1}{y}\right)\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 < -5.500202078890607e+30 or 5.839078003719052e-139 < x

    1. Initial program 0.8

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

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

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

    if -5.500202078890607e+30 < x < 5.839078003719052e-139

    1. Initial program 2.4

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

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

      \[\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-*r*2.4

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\left(x \cdot \frac{1}{y}\right) \cdot z}\right|\]
    7. Using strategy rm
    8. Applied un-div-inv2.4

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x}{y}} \cdot z\right|\]
    9. Applied associate-*l/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.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -5.500202078890607 \cdot 10^{+30}:\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \left(z \cdot \frac{1}{y}\right)\right|\\ \mathbf{elif}\;x \le 5.839078003719052 \cdot 10^{-139}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \left(z \cdot \frac{1}{y}\right)\right|\\ \end{array}\]

Runtime

Time bar (total: 17.4s)Debug logProfile

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