Average Error: 1.6 → 0.2
Time: 18.4s
Precision: 64
Internal Precision: 128
\[\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.1806749666350639 \cdot 10^{-60}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;\frac{4 + x}{y} - \frac{x}{y} \cdot z \le 2.776482164677181 \cdot 10^{-149}:\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \left(\frac{1}{y} \cdot z\right)\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.1806749666350639e-60 or 2.776482164677181e-149 < (- (/ (+ x 4) y) (* (/ x y) z))

    1. Initial program 0.3

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

    if -1.1806749666350639e-60 < (- (/ (+ x 4) y) (* (/ x y) z)) < 2.776482164677181e-149

    1. Initial program 5.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{4 + x}{y} - \frac{x}{y} \cdot z \le -1.1806749666350639 \cdot 10^{-60}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;\frac{4 + x}{y} - \frac{x}{y} \cdot z \le 2.776482164677181 \cdot 10^{-149}:\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \left(\frac{1}{y} \cdot z\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{y} \cdot z\right|\\ \end{array}\]

Runtime

Time bar (total: 18.4s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes1.60.20.01.687.1%
herbie shell --seed 2018355 +o rules:numerics
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))