Average Error: 1.7 → 0.3
Time: 22.0s
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\left(4 + x\right) - z \cdot x \le -6.597449292105928 \cdot 10^{+188} \lor \neg \left(\left(4 + x\right) - z \cdot x \le 7.32530431740223 \cdot 10^{+118}\right):\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \left(z \cdot \frac{1}{y}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (- (+ x 4) (* x z)) < -6.597449292105928e+188 or 7.32530431740223e+118 < (- (+ x 4) (* x z))

    1. Initial program 0.9

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

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

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

    if -6.597449292105928e+188 < (- (+ x 4) (* x z)) < 7.32530431740223e+118

    1. Initial program 2.0

      \[\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-div0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(4 + x\right) - z \cdot x \le -6.597449292105928 \cdot 10^{+188} \lor \neg \left(\left(4 + x\right) - z \cdot x \le 7.32530431740223 \cdot 10^{+118}\right):\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \left(z \cdot \frac{1}{y}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \end{array}\]

Runtime

Time bar (total: 22.0s)Debug logProfile

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