Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

floatToIntBits & some others!!

 
Deep Chand
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic