Average Error: 1.6 → 0.4
Time: 34.2s
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.919942449909545 \cdot 10^{+55} \lor \neg \left(x \le 1.3310619198280533 \cdot 10^{-88}\right):\\ \;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(x + 4\right) - x \cdot z\right) \cdot \frac{1}{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 < -3.919942449909545e+55 or 1.3310619198280533e-88 < x

    1. Initial program 0.5

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

    if -3.919942449909545e+55 < x < 1.3310619198280533e-88

    1. Initial program 2.4

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

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

      \[\leadsto \left|\color{blue}{\frac{\left(x + 4\right) - x \cdot z}{y}}\right|\]
    5. Using strategy rm
    6. Applied div-inv0.3

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;x \le -3.919942449909545 \cdot 10^{+55} \lor \neg \left(x \le 1.3310619198280533 \cdot 10^{-88}\right):\\ \;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(x + 4\right) - x \cdot z\right) \cdot \frac{1}{y}\right|\\ \end{array}}\]

Runtime

Time bar (total: 34.2s)Debug logProfile

herbie shell --seed '#(1072840222 1305617769 1692503039 1353360431 4178980589 1488672652)' 
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))