Average Error: 1.8 → 0.1
Time: 30.5s
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.3123812442038918 \cdot 10^{-14} \lor \neg \left(x \le 1.2452195589189322 \cdot 10^{-21}\right):\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{z}{\frac{y}{x}}\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 < -1.3123812442038918e-14 or 1.2452195589189322e-21 < x

    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|\frac{\color{blue}{1 \cdot \left(x + 4\right)}}{y} - \frac{x}{y} \cdot z\right|\]
    4. Applied associate-/l*0.3

      \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{x + 4}}} - \frac{x}{y} \cdot z\right|\]
    5. Using strategy rm
    6. Applied add-cube-cbrt0.9

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

      \[\leadsto \left|\color{blue}{(\left(\sqrt[3]{\frac{1}{\frac{y}{x + 4}}} \cdot \sqrt[3]{\frac{1}{\frac{y}{x + 4}}}\right) \cdot \left(\sqrt[3]{\frac{1}{\frac{y}{x + 4}}}\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|\]
    8. Simplified0.2

      \[\leadsto \left|\color{blue}{\left(\frac{4 + x}{y} - \frac{z}{\frac{y}{x}}\right)} + (\left(-z\right) \cdot \left(\frac{x}{y}\right) + \left(z \cdot \frac{x}{y}\right))_*\right|\]
    9. Simplified0.2

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

    if -1.3123812442038918e-14 < x < 1.2452195589189322e-21

    1. Initial program 3.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.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.3123812442038918 \cdot 10^{-14} \lor \neg \left(x \le 1.2452195589189322 \cdot 10^{-21}\right):\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{z}{\frac{y}{x}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \end{array}\]

Runtime

Time bar (total: 30.5s)Debug logProfile

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