Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / March 2006

Tip: Looking for answers? Try searching our database.

DecimalFormat ignoring exponent?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Xiao Ma - 27 Feb 2006 20:12 GMT
I use java.text.DecimalFormat returned from NumberFormat.getInstance to
parse numbers like 9E03 and 9.1E03. But it seems to ignore the exponent
and returns me 9 and 9.1, respectively. This is inconsistant with Java.
Is this a known problem? Is there a workaround?

Thanks in advance.

Xiao Ma
Lars-Inge Tønnessen (VJ# MVP) - 28 Feb 2006 18:10 GMT
Please make a small sample application to dempnstrate the problem.

Best Regards,
Lars-Inge Tønnessen
Xiao Ma - 01 Mar 2006 18:46 GMT
Here is the sample program:

==========Foo.java===============
import java.text.*;

/**
*/
public class Foo
{
    /** @attribute System.STAThread() */
    public static void main(String[] args) throws Exception
    {
        NumberFormat format = NumberFormat.getNumberInstance();
        System.out.println(format.parse("9E3"));
        System.out.println(format.parse("9.1E3"));
    }
}
=================================

The output in J# is 9 and 9.1. In Java, it's 9000 and 9100.

Xiao
Lars-Inge Tønnessen (VJ# MVP) - 19 Mar 2006 18:30 GMT
Looks like a bug to me.

It should be the same as Java.

Regards,
Lars-Inge Tønnessen

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.