Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Float problem

843785Sep 5 2008 — edited Sep 7 2008
Hi!

Here is a simple class:
public class Test {

  public static void main( String[] args ) {
    float f = Float.parseFloat( "1234567890" );
    System.out.println( "f = " + f );
  }

}
When I run this, I get the following:
f = 1.23456794E9

Why do I get this, intstead of 1.2345679E9?

regards,
Dave
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2008
Added on Sep 5 2008
30 comments
662 views