Average Error: 0.0 → 0.0
Time: 1.3s
Precision: binary64
\[\frac{\left|x - y\right|}{\left|y\right|}\]
\[\frac{\left|x - y\right|}{\left|y\right|}\]
\frac{\left|x - y\right|}{\left|y\right|}
\frac{\left|x - y\right|}{\left|y\right|}
double code(double x, double y) {
	return (((double) fabs(((double) (x - y)))) / ((double) fabs(y)));
}
double code(double x, double y) {
	return (((double) fabs(((double) (x - y)))) / ((double) fabs(y)));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\frac{\left|x - y\right|}{\left|y\right|}\]
  2. Final simplification0.0

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

Reproduce

herbie shell --seed 2020196 
(FPCore (x y)
  :name "Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5"
  :precision binary64
  (/ (fabs (- x y)) (fabs y)))