Average Error: 1.6 → 0.3
Time: 22.0s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.548388252384961 \cdot 10^{-62}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;x \le 1.8313522942110108 \cdot 10^{-97}:\\ \;\;\;\;\left|\frac{x - (z \cdot x + -4)_*}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \frac{z}{y}\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 x < -7.548388252384961e-62

    1. Initial program 0.3

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Initial simplification0.3

      \[\leadsto \left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\]
    3. Using strategy rm
    4. Applied associate-/r/0.3

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

    if -7.548388252384961e-62 < x < 1.8313522942110108e-97

    1. Initial program 3.0

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Initial simplification5.9

      \[\leadsto \left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\]
    3. Using strategy rm
    4. Applied associate-/r/3.0

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

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

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

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

    if 1.8313522942110108e-97 < x

    1. Initial program 0.5

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Initial simplification0.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -7.548388252384961 \cdot 10^{-62}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;x \le 1.8313522942110108 \cdot 10^{-97}:\\ \;\;\;\;\left|\frac{x - (z \cdot x + -4)_*}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \frac{z}{y}\right|\\ \end{array}\]

Runtime

Time bar (total: 22.0s)Debug logProfile

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