double is integer?
- From: "Guido Franzke" <guidof73@xxxxxxxx>
- Date: Sat, 3 Feb 2007 16:44:06 +0100
Hello NG,
the following source let's me check if double is integer:
bool isInteger(const double& d)
{
if ( d == (double)((int)d) ) return true;
return false;
}
isInteger(2.); -> should return true
isInteger(2.5); -> should return false
isInteger(2.001); -> should return false
My question: Is this ok, or will I get problems? Is there another (secure)
possibility?
TIA
Guido
.
- Follow-Ups:
- Re: double is integer?
- From: Joseph M . Newcomer
- Re: double is integer?
- From: Doug Harrison [MVP]
- Re: double is integer?
- Prev by Date: Re: Help finding employment
- Next by Date: Re: OnCommand
- Previous by thread: Re: problem in video for windows and tv tuners
- Next by thread: Re: double is integer?
- Index(es):
Loading