Sign in to follow this  
Followers 0
Jon

C++ Challenge

4 posts in this topic

Can anyone think of a simple way to determine if any given double data type is a whole number or not?

e.g.

double dTest = 4294967306.22452

How can I test if dTest is a whole number or a floating point given that dTest is bigger than the long integer data type so you can't just convert double to long and back then compare.

I also don't want to use __int64 because it's freaky on MinGW

There's probably a simple solution I'm completely missing. Or maybe _int64 is the only way to go.

Share this post


Link to post
Share on other sites



Convert the double to a string and search for a "."

look here

http://www.eng-tips.com/gviewthread.cfm/le...d/536/qid/53657


[quote]I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.[/quote]

Share this post


Link to post
Share on other sites

Did you find a solution to this problem, Jon, or did you just use __int64 anyway?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0