How to correctly check the accuracy to tenths or hundredths?

There is a web form where there are 2 text boxes, in these text boxes the values are entered, double, I check them so that they are accurate to two decimal places.

I do this as follows:

if ((Thickness1 * 100) % 1 != 0 || (Thickness2 * 100) % 1 != 0)
{
      Master.AlertMessage = "Толщина стенки до и после зачистки должна быть указана с точностью до десятых или до сотых";
      return false;
}

But it still doesn't skip numbers that are with two decimal places or with one

Values that fall into: Thickness1 = 8.95 and Thickness2 = 7.45

Can anyone tell me what my mistake is?

UPD:

Converting the number that comes in from the textbox to Double

 Double Thickness1 = 0;
 Double Thickness2 = 0;
 Double.TryParse(txbZachistkaThickness1.Text.Replace('.', ',').Trim(), out Thickness1);
 Double.TryParse(txbZachistkaThickness2.Text.Replace('.', ',').Trim(), out Thickness2);
Author: Harry, 2020-01-14

1 answers

Take the lines, and see what is there after the dot.

In the end, 1.00 is also a value with an accuracy of one hundredth :)

And yet - think about it-what, other than zero, can be the remainder when divided by 1? (alas, I don't know how in C#, but in C/C++ % is an integer operation, and %1 is always 0...)

 3
Author: Harry, 2020-01-14 10:55:44