Average Error: 1.6 → 2.1
Time: 12.7s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le 1.3535915025874678 \cdot 10^{+104}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - z \cdot \frac{x}{y}\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 < 1.3535915025874678e+104

    1. Initial program 1.8

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

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

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

    if 1.3535915025874678e+104 < x

    1. Initial program 0.1

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

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

      \[\leadsto \left|\color{blue}{\frac{\left(x + 4\right) - x \cdot z}{y}}\right|\]
    5. Taylor expanded around -inf 12.4

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

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

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

Reproduce

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