to the top
close form
To get a trial key
fill out the form below
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement

close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS-Studio license for Microsoft MVP specialists
** By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
** By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
** By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
>
Examples of errors detected by the V315…

Examples of errors detected by the V3157 diagnostic

V3157. Suspicious division. Absolute value of the left operand is less than the right operand.


.NET 7

V3157 The 'year % 100' expression evaluates to the value of the left operand because its absolute value is less than the right operand. GregorianCalendarHelper.cs 536


public int ToFourDigitYear(int year, int twoDigitYearMax)
{
  if (year < 0)
  {
    throw new ArgumentOutOfRangeException(nameof(year),
                                          SR.ArgumentOutOfRange_NeedPosNum);
  }

  if (year < 100)
  {
    int y = year % 100;  // <=

    return (twoDigitYearMax / 100 - (y > twoDigitYearMax % 100 ? 1 : 0))
             * 100 + y;
  }
  ....
}

Unicorn with delicious cookie
Our website uses cookies to enhance your browsing experience.
Accept