🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2779

Re: Formatting floats

#2779
From: David Liu
Date: Wed, 22 Mar 2000 00:00
48 lines
1871 bytes
This is a multi-part message in MIME format.
--------------37DF69E81D4F63179CADC3F5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi
You can use DecimalFormat class.
for example
float data; formatData;
DecimalFormat df = new DecimalFormat("0.00"); //if you want two decimal place
formatData = df.format(data);



Akber Datoo wrote:

> Hi!
>
> I need to format floats to be represented in a specified number of
> significant figures
>
> Does anyone know how I could do this? There doesn't seem to be a method in
> Float to extract the exponent and significand separately.
>
>
>
> Thanks in advance,
> Akber Datoo.

--------------37DF69E81D4F63179CADC3F5
Content-Type: text/x-vcard; charset=us-ascii;
 name="dliu.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for David Liu
Content-Disposition: attachment;
 filename="dliu.vcf"

begin:vcard 
n:Liu;David
tel;work:03 92091600
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:dliu@au.oracle.com
fn:David Liu
end:vcard

--------------37DF69E81D4F63179CADC3F5--
Technical Details
Message-ID: <38D803D5.288F0F2E@au.oracle.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <89po1m$qu04@bornews.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,88f18f0a95ed80e3
X-Google-Attributes: gid1089d0,public
From: David Liu <dliu@au.oracle.com>
Subject: Re: Formatting floats
Date: 2000/03/22
Message-ID: <38D803D5.288F0F2E@au.oracle.com>
X-Deja-AN: 600627066
References: <89po1m$qu04@bornews.borland.com>
To: Eddie Kaul <akaul@au.oracle.com>
X-Accept-Language: en
Content-Type: multipart/mixed; boundary="------------37DF69E81D4F63179CADC3F5"
X-Complaints-To: usenet@inet16.us.oracle.com
X-Trace: inet16.us.oracle.com 953681095 750 140.83.39.40 (21 Mar 2000 23:24:55 GMT)
Organization: Oracle Corporation Australia Pty Ltd
Mime-Version: 1.0
NNTP-Posting-Date: 21 Mar 2000 23:24:55 GMT
Newsgroups: borland.public.jbuilder.java.api