# Thread: Testing for a decimal point

1. ## Testing for a decimal point

Is there anyway to test whether a 'double' contains a decimal point?

2. You misunderstand how floating point numbers are stored. A double is a floating point number, which itself means that the number is stored in such a manner that the decimal point is accounted for even when there are nothing but 0s to the right of it.

So, in a totally useless snippet of code..
Code:
```bool doesDoubleContainDecimalPoint(double d) {
return true;
}```
However, you probably meant "How can I check if a double is an integer?" Well.. in that case..

Code:
```#include <cmath>
#include <iostream>

bool isInteger(double d) {
// check floor docs at
// http://www.cplusplus.com/ref/cmath/floor.html
return d == floor(d);
}

void test(double d) {
std::cout << d << " is ";
if (!isInteger(d)) std::cout << "not ";
std::cout << "an integer" << std::endl;
}

int main() {
test(3.0);
test(2);
test(3.14124);
test(sqrt(1000.0*1000.0));
return 0;
}```