How to be warned about potential arithmetic errors due to type conversion?
I am working on a calculation module using C#, and I bumped on this : double v = 4 / 100; I know this is a wrong initialization that returns v = 0.0 instead of v = 0.04 The c# rules says I must ensure at least one of the member is a double , like this : double v = (double) 4 / 100; double v = 4.0 / 100; However, I have many many initializations of that kind that involves integer variables operations, and I feel lazy to browse my code line by line to detect such mistakes. Instead, is it possible to get warned by the compiler about this ? Alright, after some playing around and what not, I have a