merse 0 Junior Poster

If a double is initialized with 3.0 than we get an exact double,
I mean 3.0 is an exact binary number,
therefore 3.0 has no error during the conversion.
But for example 0.1 is not an exact binary
therefore the number (double)0.1 has error in its last digit.
I would like to determine if a number is an exact binary or not,
but the problem is that the conversion is automatic in C++.
So the input parameter must be a string "0.1" and not a number 0.1,
because the latter one is already converted.
Are there any kind of solution?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.