Average Error: 1.6 → 0.1
Time: 1.2m
Precision: 64
Internal Precision: 384
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.4587359327969505 \cdot 10^{+31}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - x \cdot \frac{z}{y}\right|\\ \mathbf{if}\;y \le 1.5560110625187385 \cdot 10^{-13}:\\ \;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \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 3 regimes
  2. if y < -3.4587359327969505e+31

    1. Initial program 3.0

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

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

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

    if -3.4587359327969505e+31 < y < 1.5560110625187385e-13

    1. Initial program 0.1

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

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

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

    if 1.5560110625187385e-13 < y

    1. Initial program 2.5

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

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

      \[\leadsto \color{blue}{\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{\frac{y}{z}}\right|}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1062930989 876886121 3990119081 3032829768 3060892583 1929069376)' 
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))