This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Posted by Saurabh Ganguly on July 02, 2001 at 3:42 AM
I am facing a problem in conversion os String to float.So I thought of contacting you .
I have written the following code for conversion from String to float and then limiting to 2 numbers after decimal.
DecimalFormat numformat = new DecimalFormat();
totalQty is a float quantity.
But what happens is that I am not getting exact results.I mean if the result is .756 then its coming as .76.
SO I want a solution cos it can lead to calculation differences.
Hoping for a positive reply.