Average Error: 1.8 → 0.3
Time: 1.1m
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\left(x + 4\right) - z \cdot x \le -7.5332432475681365 \cdot 10^{+152}:\\ \;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;\left(x + 4\right) - z \cdot x \le 7.768661451409932 \cdot 10^{+148}:\\ \;\;\;\;\left|\frac{\left(x + 4\right) - z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{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 (- (+ 4 x) (* z x)) < -7.5332432475681365e+152 or 7.768661451409932e+148 < (- (+ 4 x) (* z x))

    1. Initial program 0.8

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

    if -7.5332432475681365e+152 < (- (+ 4 x) (* z x)) < 7.768661451409932e+148

    1. Initial program 2.2

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Initial simplification0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x + 4\right) - z \cdot x \le -7.5332432475681365 \cdot 10^{+152}:\\ \;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\ \mathbf{elif}\;\left(x + 4\right) - z \cdot x \le 7.768661451409932 \cdot 10^{+148}:\\ \;\;\;\;\left|\frac{\left(x + 4\right) - z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\ \end{array}\]

Runtime

Time bar (total: 1.1m)Debug logProfile

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