int difference(unsigned a,unsigned b) {return abs(a-b);}
This can go very wrong because of unsigned integer arithmetic... need abs((int)a-(int)b)!

· · Web · 1 · 0 · 0
Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!