Average Error: 1.8 → 0.4
Time: 42.0s
Precision: 64
Internal Precision: 384
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -8.466722872695738 \cdot 10^{+25}:\\ \;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\ \mathbf{if}\;x \le 1.4846711502768621 \cdot 10^{-74}:\\ \;\;\;\;\left|\frac{\left(x - 4\right) \cdot \left(\left(x + 4\right) - x \cdot z\right)}{\left(x - 4\right) \cdot y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{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 2 regimes
  2. if x < -8.466722872695738e+25 or 1.4846711502768621e-74 < x

    1. Initial program 0.3

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

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

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

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

    if -8.466722872695738e+25 < x < 1.4846711502768621e-74

    1. Initial program 2.9

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied div-inv2.9

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

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

      \[\leadsto \left|\color{blue}{\frac{x \cdot x - 4 \cdot 4}{x - 4}} \cdot \frac{1}{y} - \frac{x \cdot z}{y}\right|\]
    7. Applied associate-*l/0.2

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

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

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

Runtime

Time bar (total: 42.0s)Debug logProfile

herbie shell --seed '#(1070864556 424010669 783715395 1203517814 4070606583 4107618214)' 
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))