Average Error: 1.7 → 0.2
Time: 11.8s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.612906667997141 \cdot 10^{-13}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;x \le 3.3736441635224925 \cdot 10^{-73}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \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 3 regimes
  2. if x < -3.612906667997141e-13

    1. Initial program 0.1

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

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

    if -3.612906667997141e-13 < x < 3.3736441635224925e-73

    1. Initial program 2.9

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

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

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

      \[\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|\]

    if 3.3736441635224925e-73 < x

    1. Initial program 0.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -3.612906667997141 \cdot 10^{-13}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;x \le 3.3736441635224925 \cdot 10^{-73}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{y} \cdot z\right|\\ \end{array}\]

Runtime

Time bar (total: 11.8s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes1.70.20.01.789.5%
herbie shell --seed 2018351 
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))