A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Certification
»
Programmer Certification (SCJP/OCPJP)
Author
Loss of precision when converting int to float
nishant vats
Greenhorn
Joined: Feb 11, 2005
Posts: 23
posted
May 11, 2005 00:07:00
0
int k=944444444;
float f2=k;
System.out.println("f2 "+f2);
output is :f2 9.4444442E8
int k=94444444;
float f2=k;
System.out.println("f2 "+f2);
output is :f2 9.4444448E7
Note that in frist case there are 9 digits while in second case its 8 digits..
pls explain the output
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: Loss of precision when converting int to float
Similar Threads
Wrapper class
float
Assignment doubt
Float and ==
whats the difference between float & double
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter