C# Sorting - A Minor Errorby@davidebellone

C# Sorting - A Minor Error

tldt arrow
Read on Terminal Reader🖨️

Too Long; Didn't Read

It isn't true that the inverse of a negative number is a positive number. The inverse of -2,147,483,648 would cause overflow and returns the same value. The best solution is to simply switch the parameters: CompareTo(y, x). The result is a terrible idea to use CompareTo(-x, -y). Results can be unexpected. The lesson is that we must know the basics of a language not only in terms of syntax but also the inner handling of inner handling.
featured image - C# Sorting - A Minor Error
Davide Bellone | Code4IT HackerNoon profile picture

@davidebellone

Davide Bellone | Code4IT

Learn More
LEARN MORE ABOUT @DAVIDEBELLONE'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa