This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes floatToIntBits & some others!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "floatToIntBits & some others!!" Watch "floatToIntBits & some others!!" New topic
Author

floatToIntBits & some others!!

Deep Chand
Ranch Hand

Joined: Dec 17, 2002
Posts: 133
Hi All,
I went thru' the 1.4 api for 'Float' class but couldn't understand the purpose of following methods.
API says:
floatToIntBits(float) - Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout.
Similarly, intBitsToFloat(int) method.
I know I may sound a little dumb here...but when I tried to use these functions the output I got confused me even more...any help/clue would be appreciated.
thanks,
deep
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

I think the key thing you need to read is that it has to do with the IEE754 standard. Something the majority of us will never ever ever ever (get it?) use. It deals with getting exact values with floating points or something. (Similar to strictfp).
You don't need to know it for the exam... and if you ever need to do exact floating point stuff -- you can read the IEE754 standard -- maybe you can write up an article for the JavaRanch newsletter about it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: floatToIntBits & some others!!
 
Similar Threads
equals()
How to pass a long in ...Long ll = Long.valueOf(3L);//gives
Float.floatToIntBits( float )
why equals methods printing false ?
converting float hex to int