Average Error: 1.5 → 0.4
Time: 2.9m
Precision: 64
Internal Precision: 384
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.0888266732824329 \cdot 10^{+111}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{if}\;x \le 4.7716866652872695 \cdot 10^{+54}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|(\left(\frac{x}{y}\right) \cdot \left(-z\right) + \left(\frac{4}{y} + \frac{x}{y}\right))_*\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 < -1.0888266732824329e+111

    1. Initial program 0.1

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.1

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

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

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

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

    if -1.0888266732824329e+111 < x < 4.7716866652872695e+54

    1. Initial program 1.9

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

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

    if 4.7716866652872695e+54 < x

    1. Initial program 0.1

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

      \[\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{x}{y}\right) \cdot \left(-z\right) + \left(\frac{4}{y} + \frac{x}{y}\right))_*\right|}\]
  3. Recombined 3 regimes into one program.
  4. Applied simplify0.4

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;x \le -1.0888266732824329 \cdot 10^{+111}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{if}\;x \le 4.7716866652872695 \cdot 10^{+54}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|(\left(\frac{x}{y}\right) \cdot \left(-z\right) + \left(\frac{4}{y} + \frac{x}{y}\right))_*\right|\\ \end{array}}\]

Runtime

Time bar (total: 2.9m)Debug logProfile

herbie shell --seed '#(1070833653 108281690 3330367898 3632331308 3494323072 43156186)' +o rules:numerics
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))