On 29/08/06, Floyd Wright <tfwright / thoughtbot.com> wrote:
> irb(main):005:0> 1.5.integer?
> => false
>
> William Crawford wrote:
> > Farrel Lifson wrote:
> >> On 29/08/06, James Deuchar <jamesdeuchar / hotmail.com> wrote:
> >>> I feel certain I must be missing a trick here...am about to go down the
> >>> --
> >>> Posted via http://www.ruby-forum.com/.
> >>>
> >>>
> >> Check if num.to_f - num.to_i == 0, if that's true you're dealing with
> >> a integer otherwise a float.
> >>
> >> Farrel
> >
> > num.to_f == num.to_i
> >
> > Would also give true/false on whether or not it's an integer or not.
> >
>
>
>

Or you could just use that. Three cheers for the principle of least suprise!