JDK-4175609 : java.io: Add facility for convenient formatting of numeric output
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.1.6,1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1998-09-22
  • Updated: 2000-03-10
  • Resolved: 2000-03-10
Related Reports
Duplicate :  
Description
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?

Comments
WORK AROUND
11-06-2004

SUGGESTED FIX
11-06-2004

PUBLIC COMMENTS
10-06-2004

EVALUATION To be addressed as part of the New I/O work. -- mr@eng 2000/3/9
03-08-0175