[5113] in java-interest

home help back first fref pref prev next nref lref last post

String and Number wrappers

daemon@ATHENA.MIT.EDU (Jill Shermer)
Mon Jan 29 16:13:51 1996

Date: Mon, 29 Jan 1996 11:49:26 -0800
From: jshermer@BASISinc.com (Jill Shermer)
To: java-interest@java.sun.com

Hi Java Team,

I am trying to do calculations for financial reports. I am having problems
avoiding automatic rounding up of my values.  I also have problems 
avoiding the scientific notation format that is forced on values that
are at least 10e+5.


I haven't had desirable results using the number wrapper classes
to solve these problems.  If I need to handle calculations in C, or C++ native
code to achieve these needs, that's fine, but I need to know if
I am incorrectly using Java here, with/without making use of
the Number wrappers
  
I use the following lines to obtain a product:

double num;
double factor = 2.0;
double bigNumber = 3000000.33;

num = factor * bigNumber;
System.out.println("Factored number is " + String.valueOf(num));

Standard out displays: Factored number is 6e+06

It is necessary that I show 6000000.66 here.
And, if I set bigNumber = 200000.33,
standard shows the factored number is 400001
It is necessary that I show 400000.66 here.
(Using methods from the Double class don't see to help either.)


Perhaps I am not using the String wrapper classes correctly?
. 

Thanks in advance for your reply,

-Jill
 
 
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post