Average Error: 1.5 → 1.5
Time: 5.5s
Precision: binary64
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
\[\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{y} \cdot z\right| \]
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{y} \cdot z\right|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
(FPCore (x y z)
 :precision binary64
 (fabs (- (+ (/ 4.0 y) (/ x y)) (* (/ x y) z))))
double code(double x, double y, double z) {
	return fabs(((x + 4.0) / y) - ((x / y) * z));
}
double code(double x, double y, double z) {
	return fabs(((4.0 / y) + (x / y)) - ((x / y) * z));
}

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. Initial program 1.5

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

    \[\leadsto \left|\color{blue}{\left(\frac{x}{y} + 4 \cdot \frac{1}{y}\right)} - \frac{x}{y} \cdot z\right| \]
  3. Taylor expanded in y around 0 1.5

    \[\leadsto \left|\color{blue}{\frac{4 + x}{y}} - \frac{x}{y} \cdot z\right| \]
  4. Simplified1.5

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

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

Reproduce

herbie shell --seed 2022061 
(FPCore (x y z)
  :name "fabs fraction 1"
  :precision binary64
  (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))