Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

An issue with this code is actually the equal test of double (floating point numbers).

 if (list[i] == list[j]) ...

It is more common to test almost equal almost equal.

 if (Math.abs(list[i] - list[j]) < EPSILON) ...

An issue with this code is actually the equal test of double (floating point numbers).

 if (list[i] == list[j]) ...

It is more common to test almost equal.

 if (Math.abs(list[i] - list[j]) < EPSILON) ...

An issue with this code is actually the equal test of double (floating point numbers).

 if (list[i] == list[j]) ...

It is more common to test almost equal.

 if (Math.abs(list[i] - list[j]) < EPSILON) ...
deleted 10 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

An issue with this code is actually the equal test of doubledouble (floating point numbers).

 if (list[i] == list[j]) ...

It is more common to test almost equal.

 if (Math.abs(list[i] - list[j]) < EPSILON) ...

Cheers!

An issue with this code is actually the equal test of double (floating point numbers).

 if (list[i] == list[j]) ...

It is more common to test almost equal.

 if (Math.abs(list[i] - list[j]) < EPSILON) ...

Cheers!

An issue with this code is actually the equal test of double (floating point numbers).

 if (list[i] == list[j]) ...

It is more common to test almost equal.

 if (Math.abs(list[i] - list[j]) < EPSILON) ...
Source Link

An issue with this code is actually the equal test of double (floating point numbers).

 if (list[i] == list[j]) ...

It is more common to test almost equal.

 if (Math.abs(list[i] - list[j]) < EPSILON) ...

Cheers!

lang-java

AltStyle によって変換されたページ (->オリジナル) /