Average Error: 1.6 → 0.4
Time: 43.5s
Precision: 64
Internal Precision: 320
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\frac{x + 4}{y} - \frac{x}{y} \cdot z \le -8.265162206453387 \cdot 10^{+139}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\\ \mathbf{if}\;\frac{x + 4}{y} - \frac{x}{y} \cdot z \le 1.709227630184866 \cdot 10^{-212}:\\ \;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \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 y) z)) < -8.265162206453387e+139 or 1.709227630184866e-212 < (- (/ (+ x 4) y) (* (/ x y) z))

    1. Initial program 0.4

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

    if -8.265162206453387e+139 < (- (/ (+ x 4) y) (* (/ x y) z)) < 1.709227630184866e-212

    1. Initial program 3.4

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

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

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

      \[\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: 43.5s)Debug logProfile

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