🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17283

About Class Double.doubleValue() and Float.floatValue()

#17283
From: GLTTW
Date: Wed, 25 Nov 1998 00:00
15 lines
874 bytes
Recently I need to convert string to double or float value.
But something is strange.

For example:

Double D1 = new Double("34.5678999999");
Float F1 =  new Float("34.5678999999");
double d = D1.doubleValue();
float f = F1.floatValue();

and the result of the d or f is 34.568.
Does any one know how to control the rounding
of these 2 class?

Toni
Technical Details
Message-ID: <365BB5F7.484DCFC4@artic.com.tw>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,cf2f9a88ea605d6,start
X-Google-Attributes: gidf74b3,public
From: GLTTW <glt@artic.com.tw>
Subject: About Class Double.doubleValue() and Float.floatValue()
Date: 1998/11/25
Message-ID: <365BB5F7.484DCFC4@artic.com.tw>
X-Deja-AN: 415448310
Content-Transfer-Encoding: 7bit
Organization: Another Netscape Collabra Server User
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language