Math
class CS-R1071Math
class16 // https://deepsource.io/directory/analyzers/csharp/issues/CS-W1000
17 var intro = $"My name is name";
18
19 var pi = 3.14;20 // CS-W1003: Invalid comparison against `NaN`.
21 // https://deepsource.io/directory/analyzers/csharp/issues/CS-W1003
22 var isNaN = pi == double.NaN;
Constants such as pi
, e
, and tau
are already defined in the Math
class. Consider using them instead of manually defining the literal yourself. This makes it easier to read and follow the code.
var pi = 3.14;
var pi = Math.PI;