News for hackers. Stuff that matters.
Re:Mathematics for Programmers [pdf] by eru on Thursday September 24, 2020 @03:18AM (#24576147)
If you are using C or C++, you need to be extremely careful with signed integers, even when working modulo. Their overflow is undefined.
Re:Mathematics for Programmers [pdf] by boston_clone on Thursday September 24, 2020 @12:46PM (#24580590)
Is that due to the division taking place like the parent mentions, or something else?
Re:Mathematics for Programmers [pdf] by eru on Friday September 25, 2020 @04:51AM (#24587917)
Due to how C and C++ are defined in their standards.

The reason behind that is so that the compiler is allowed to assume that expressions like (x + 1 > x) are true, and thus can optimise more.