Is That Any calculation or method allow me to check whether a double value is Int or Double in c# code
Example
Double NumberOne = 55.00 // Return False
Double NumberTwo = 55.10 // Return True
Use Math.Floor
if (Math.Floor(number) == number) {
// yay, an "int"
}
private bool IsDoubleNotAnInt(double num)
{
if ((num % 1) == 0)
{
return false;
}
else
{
return true;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With