"David Harmon" <(EMail Removed)> wrote in message
news:(EMail Removed)...
> On Tue, 28 Sep 2004 17:43:34 GMT in comp.lang.c++, "Mike Wahler"
> <(EMail Removed)> wrote,
> >> if (d == floor(d))
> >> // d is an integer
> >
> >Another alternative is to use 'modf()'.
>
> And there are others. But testing any floating point result for any
> exact value
OP is not looking for an 'exact value', but simply whether
a real number has a fractional part. Also note that types
'float' and 'double' can indeed represent integers exactly.
> typically indicates wrong thinking in the design anyway.
I don't think it's 'wrong thinking' to try to determine
if a real number has a fractional part (unless of course
it's not really needed by the application being written).
Mike
