jQuery in Action, 2nd edition
The moose likes Java in General and the fly likes float binary makeup Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "float binary makeup" Watch "float binary makeup" New topic
Author

float binary makeup

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Hi guys , Im trying to figure out how java floats are stored in binary.
The floatToRawIntBits method is supposed to yield an integer that can be masked
to reveal the underlying float representation in terms of (1) exponent and a (2) significand...

However, when i run the following code (to print exponent and significand for numbers 1 through 10) ....



I get some very strange looking binary numbers ... the output is below



Can somebody explain this ?

Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12907
    
    3

The format that Java uses is the single-precision (binary32) format of the IEEE-754 standard.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: float binary makeup
 
Similar Threads
Double.toHexString.
Floating point variables
Convert Decimal to IEEE 754 number
assign float to int ??
int to float 16777217