aspose file tools*
The moose likes Beginning Java and the fly likes how to convert float to int? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to convert float to int?" Watch "how to convert float to int?" New topic
Author

how to convert float to int?

Anto Telvin
Ranch Hand

Joined: Aug 12, 2008
Posts: 113
hi all

how to convert float to int manually using paper


Anto Telvin Mathew<br />Many of the life failures are people who did not realize how close they were to success when they give up. EDISON
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18989
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18989
    
  40

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

Joined: Aug 03, 2008
Posts: 200
convert float to int.

least significant digits may be tructated.
shukla raghav
Ranch Hand

Joined: Aug 03, 2008
Posts: 200
i am sorry highest order bits will be truncated
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to convert float to int?