check Fixnum

S

Stanislav Orlenko

Hi
I have Fixnum. I want to check does this value integer or float, i. e.
has .xx in the trail or not. How can I check this?
Thanks in advance
 
B

Brian Candler

Stanislav said:
I have Fixnum. I want to check does this value integer or float, i. e.
has .xx in the trail or not. How can I check this?

"Fixnum" means "fixed point", or really "small integer": a Fixnum can
never be a float.

$ irb --simple-prompt
 
L

Louis-Philippe

[Note: parts of this message were removed to make it a legal post.]

2010/6/15 Stanislav Orlenko said:
Hi
I have Fixnum. I want to check does this value integer or float, i. e.
has .xx in the trail or not. How can I check this?
Thanks in advance
check your reference...
Fixnum are Integers, not float...
you are probably mislead by Numeric... because Integer and Float are
Numeric

a = 0.1
a.class
=> Float

b = 1
b.class
=> Fixnum

a.is_a? Numeric
=> true

b.is_a? Numeric
=> true
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,149
Messages
2,570,841
Members
47,388
Latest member
EarthaGilm

Latest Threads

Top