🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Simple problem for float calculation

#2479
From: Gregory Klebanov
Date: Sun, 12 Nov 2000 00:00
14 lines
1060 bytes
the guy is right - u should use doubles instead
"eLe" <petruschan@realink.com.hk> wrote in message news:39ec3576_2@dnews...
> I have Java program simple as :
>
> float a = 27.1
> float b = 0.2
> float c = a + b
> c = 27.300001
>
> I want the ans is c = 27.3 is not 27.300001
>
> How to solve this problem ? thank you !
>
>
Technical Details
Message-ID: <t2yP5.108749$td5.16343607@news1.rdc2.pa.home.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39ec3576_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,9bcc96b038465cb3
X-Google-Attributes: gid1089d0,public
From: "Gregory Klebanov" <gregory.klebanov@modernsystemdesign.com>
Subject: Re: Simple problem for float calculation
Date: 2000/11/12
Message-ID: <t2yP5.108749$td5.16343607@news1.rdc2.pa.home.com>
X-Deja-AN: 692708310
References: <39ec3576_2@dnews>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Complaints-To: abuse@home.net
X-Trace: news1.rdc2.pa.home.com 974040345 24.40.2.118 (Sun, 12 Nov 2000 06:45:45 PST)
Organization: @Home Network
X-MSMail-Priority: Normal
NNTP-Posting-Date: Sun, 12 Nov 2000 06:45:45 PST
Newsgroups: borland.public.jbuilder.java.api