Average Error: 1.9 → 0.2
Time: 7.9s
Precision: 64
Internal precision: 384
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -5.74129741148558 \cdot 10^{-14}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - x \cdot \frac{z}{y}\right|\\ \mathbf{if}\;x \le 1.5179704607986919 \cdot 10^{-58}:\\ \;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - 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 2 regimes.
  2. if x < -5.74129741148558e-14 or 1.5179704607986919e-58 < x

    1. Initial program 0.2

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Applied taylor 0.2

      \[\leadsto \left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x}{y} \cdot z\right|\]
    3. Taylor expanded around 0 0.2

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

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

    if -5.74129741148558e-14 < x < 1.5179704607986919e-58

    1. Initial program 3.3

      \[\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-div 0.1

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

Runtime

Time bar (total: 7.9s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1064524629 4159152179 2999149171 575749698 4006532819 692958815)'
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))