Average Error: 1.7 → 0.3
Time: 11.3s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.8277405188536494 \cdot 10^{+94} \lor \neg \left(x \le 1.4498948946987198 \cdot 10^{-52}\right):\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\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.8277405188536494e+94 or 1.4498948946987198e-52 < x

    1. Initial program 0.2

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

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

    if -4.8277405188536494e+94 < x < 1.4498948946987198e-52

    1. Initial program 2.6

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

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

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

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

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

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

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

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

Runtime

Time bar (total: 11.3s)Debug logProfile

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