Average Error: 1.5 → 0.2
Time: 11.0s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.243732410809643 \cdot 10^{-56} \lor \neg \left(x \le 7.987255754900607 \cdot 10^{+20}\right):\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{1}{\frac{y}{z}} \cdot x\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{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.243732410809643e-56 or 7.987255754900607e+20 < x

    1. Initial program 0.3

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Taylor expanded around 0 7.8

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

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

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

    if -1.243732410809643e-56 < x < 7.987255754900607e+20

    1. Initial program 2.5

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Taylor expanded around inf 0.1

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

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

Reproduce

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