Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4175609

java.io: Add facility for convenient formatting of numeric output

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.6, 1.2.0
    • core-libs
    • None
    • generic
    • generic

      Date: Sat, 15 Aug 1998 22:19:59 GMT
      From: <###@###.###>
      Subject: IO Issue: numeric text output

               Name: Doug Lutterloh
              Email: ###@###.###
       Phone Number: 513-530-0745
           Location: North America
             System: Linux
      Referring URL: http://www.javasoft.com/nav/developer/index.html

      I use Java to write stand alone apps that sometimes
      require formatted text output. For example,
      I may want a table of numeric results such as:

      1 5.67 456.442
      2 .59 -7.300
      ...

      With C, I could use the "printf" command and specify
      the maximum field width of each number, precision,
      left/right justification, scientific notation, etc.
      Java seems to have no comparable functionality. Printing
      numeric results with precise control of length, spacing,
      etc. seems impossible with Java at this time. This
      is a real problem for those of us who are trying to use
      Java for scientific/mathematical applications instead
      of just web toys.

      --------

      From: James L Espinosa <###@###.###>
      To: "'###@###.###'" <###@###.###>
      Subject: Printing a double data type number with a rounded number of signi
      ficat digits
      Date: Tue, 22 Sep 1998 17:19:01 -0500

                 Dear Sirs,
                    I have a program that has a variable with a data type of
      double. It gets a value of 4.47213595 and I want
         to print it as a number with four significant digits and rounded. In
      this example, I would want the number to
         print as 4.4721. How can I do this. I am using JDK1.1.6 and have tried
      to find the information in the online
         help but I cannot find it. Can you help?

            mr Mark Reinhold
            mr Mark Reinhold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: