m(234.8987));
}
}
-Original Message-
From: Chris Pratt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 2:46 AM
To: [EMAIL PROTECTED]
Subject: Re: offtopic : to truncate a double
Take a look at the java.text.DecimalFormat()
(*Chris*)
- Original Message -
From: "Richa
Hi
for working with numbers and date check out the java.text package.
In your case, try the java.text.DecimalFormat.
You could also round a number to two decimal places by multiplying it by
tens multiple, taking the integral part and dividing by tens multiple.
Ex
x = x * 100;
x = integral part
Take a look at the java.text.DecimalFormat()
(*Chris*)
- Original Message -
From: "Richard Yee" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 28, 2001 1:09 PM
Subject: Re: [JSP-INTEREST] offtopic : to truncate a double
> Raj,
>
Raj,
There is not a method that truncates a double to a certain
precision. Check out this link for an explanation on Performing Exact
Calculations With Floating-Point Numbers
http://developer.java.sun.com/developer/JDCTechTips/2001/tt0807.html
Basically, can either use the BigDecimal class that
Hi.
you can check out the following methods in math class.
round(double a)
Returns the closest long to the argument.
round(float a)
Returns the closest int to the argument.
Hope this helps you.
rgds
Senthil
At 09:53 PM 27/08/2001 -0700, you wrote:
>Hi all,
>
>i have variable double x = 34.89
Hi all,
i have variable double x = 34.8976 ;
i want only 2 digits after decimal. Is there any method returning double
and gives value x = 34.89 ???
Cheers!!
Raj
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "sign