Average Error: 1.5 → 0.1
Time: 27.0s
Precision: 64
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -162471292.3498542:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;x \le 1.068626064694855 \cdot 10^{-49}:\\ \;\;\;\;\left|\frac{x \cdot x + -16}{y \cdot \left(x - 4\right)} - \frac{z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\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 x < -162471292.3498542 or 1.068626064694855e-49 < x

    1. Initial program 0.2

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

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}}\right|\]
    3. Using strategy rm
    4. Applied associate-/l*0.2

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

    if -162471292.3498542 < x < 1.068626064694855e-49

    1. Initial program 2.5

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

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}}\right|\]
    3. Using strategy rm
    4. Applied flip-+0.1

      \[\leadsto \left|\frac{\color{blue}{\frac{x \cdot x - 4 \cdot 4}{x - 4}}}{y} - \frac{x \cdot z}{y}\right|\]
    5. Applied associate-/l/0.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -162471292.3498542:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;x \le 1.068626064694855 \cdot 10^{-49}:\\ \;\;\;\;\left|\frac{x \cdot x + -16}{y \cdot \left(x - 4\right)} - \frac{z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \end{array}\]

Reproduce

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