Average Error: 1.6 → 0.4
Time: 9.1s
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\frac{4 + x}{y} - \frac{x}{y} \cdot z \le -1.1558322353924661 \cdot 10^{+131}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;\frac{4 + x}{y} - \frac{x}{y} \cdot z \le 6.312095655418634 \cdot 10^{+167}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{y} \cdot z\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) y) (* (/ x y) z)) < -1.1558322353924661e+131 or 6.312095655418634e+167 < (- (/ (+ x 4) y) (* (/ x y) z))

    1. Initial program 0.1

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

    if -1.1558322353924661e+131 < (- (/ (+ x 4) y) (* (/ x y) z)) < 6.312095655418634e+167

    1. Initial program 2.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{4 + x}{y} - \frac{x}{y} \cdot z \le -1.1558322353924661 \cdot 10^{+131}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;\frac{4 + x}{y} - \frac{x}{y} \cdot z \le 6.312095655418634 \cdot 10^{+167}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{y} \cdot z\right|\\ \end{array}\]

Runtime

Time bar (total: 9.1s)Debug logProfile

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