Average Error: 0.0 → 0.0
Time: 1.3s
Precision: binary64
\[\frac{\left|x - y\right|}{\left|y\right|} \]
\[\frac{\left|y - x\right|}{\left|y\right|} \]
(FPCore (x y) :precision binary64 (/ (fabs (- x y)) (fabs y)))
(FPCore (x y) :precision binary64 (/ (fabs (- y x)) (fabs y)))
double code(double x, double y) {
	return fabs((x - y)) / fabs(y);
}
double code(double x, double y) {
	return fabs((y - x)) / fabs(y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = abs((x - y)) / abs(y)
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = abs((y - x)) / abs(y)
end function
public static double code(double x, double y) {
	return Math.abs((x - y)) / Math.abs(y);
}
public static double code(double x, double y) {
	return Math.abs((y - x)) / Math.abs(y);
}
def code(x, y):
	return math.fabs((x - y)) / math.fabs(y)
def code(x, y):
	return math.fabs((y - x)) / math.fabs(y)
function code(x, y)
	return Float64(abs(Float64(x - y)) / abs(y))
end
function code(x, y)
	return Float64(abs(Float64(y - x)) / abs(y))
end
function tmp = code(x, y)
	tmp = abs((x - y)) / abs(y);
end
function tmp = code(x, y)
	tmp = abs((y - x)) / abs(y);
end
code[x_, y_] := N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]
\frac{\left|x - y\right|}{\left|y\right|}
\frac{\left|y - x\right|}{\left|y\right|}

Error

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. Simplified0.0

    \[\leadsto \color{blue}{\frac{\left|y - x\right|}{\left|y\right|}} \]
  3. Final simplification0.0

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

Reproduce

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