This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to convert float to int?

 
Anto Telvin
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all

how to convert float to int manually using paper
 
Henry Wong
author
Marshal
Pie
Posts: 20889
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anto telvin Mathew:
hi all

how to convert float to int manually using paper


You already asked how to manually convert between floating point numbers which requires you to understand the IEEE format. You already asked how to convert amoung the whole numbers, which requires you to understand twos complements.

There is no black magic here. Once you understand both, you can do the conversion easily. Of course, understanding both, particularly the IEEE format is not easy. In fact, IMO, I believe the IEEE format may be a waste of time for any beginner to try to figure it out -- it is just annoyingly difficult.

Henry
 
Henry Wong
author
Marshal
Pie
Posts: 20889
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This post is purely for future reference -- as in time, the other posts mentioned, may be far from this one. So, for anyone else that are interested, here are the related posts that I referred Anto to...

http://www.coderanch.com/t/411847/java/java/convert-double-float

http://www.coderanch.com/t/411840/java/java/convert-number-IEEE-FPS

http://www.coderanch.com/t/411848/java/java/convert-long-byte

http://www.coderanch.com/t/411768/java/java/converting-int-byte

Henry
 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
convert float to int.

least significant digits may be tructated.
 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am sorry highest order bits will be truncated
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic