Average Error: 1.7 → 0.2
Time: 14.7s
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0008326023326523418 \lor \neg \left(x \le 3.5739568166003117 \cdot 10^{-115}\right):\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{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 < -0.0008326023326523418 or 3.5739568166003117e-115 < x

    1. Initial program 0.6

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

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

      \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{x + 4}}} - \frac{x}{y} \cdot z\right|\]
    5. Taylor expanded around -inf 6.3

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

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

    if -0.0008326023326523418 < x < 3.5739568166003117e-115

    1. Initial program 2.7

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

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

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{x \cdot \left(\frac{1}{y} \cdot z\right)}\right|\]
    5. Using strategy rm
    6. Applied associate-*l/5.9

      \[\leadsto \left|\frac{x + 4}{y} - x \cdot \color{blue}{\frac{1 \cdot z}{y}}\right|\]
    7. Applied associate-*r/0.1

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

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

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

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

Runtime

Time bar (total: 14.7s)Debug logProfile

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