posted 20 years ago
hai friends,
I have a seires of problems.
1)
int i1=5;
float f1=5.0f ,f2 =5.1f;
double d1=5.0 ,d2=5.1;
i used if condition to check like this..
if(i1==f1) gave me true
if(f1==d1) gave me true
if(f2==d2) amazingly false . why??
plz explain me whatz the prob actually.
-----------------------------
2) inside the switch if i want to use float values how can we do that.
------------------------------
3) just look at the following.
float f= 0.20f; double d=0.8; System.out.println(f+d);
can u tell me whats the o/p.
Do u think it is 1.000 (or like that)
Exactly No.
if u don't believe me write a prgm and check it out.
it will display : 1.0000000029802323
whatz actually this. it is suppose to be 1.000(say).
Any tech-savy there to solve my doubt.
------------------
4)
Guyz, will u plz explain me how to compute shift operations on
hexadecimal ints like
int i1 = 0xffffffff, i2 = i1 << 1;i3=i1>>1; etc
thanks
regards,
Mahesh