🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Simple problem for float calculation

#2534
From: eLe
Date: Tue, 17 Oct 2000 00:00
10 lines
749 bytes
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: <39ec3576_2@dnews>
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: 1089d0,9bcc96b038465cb3,start
X-Google-Attributes: gid1089d0,public
From: "eLe" <petruschan@realink.com.hk>
Subject: Simple problem for float calculation
Date: 2000/10/17
Message-ID: <39ec3576_2@dnews>
X-Deja-AN: 682425589
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
X-Trace: 17 Oct 2000 04:18:14 -0800, 202.80.7.132
Organization: Java Developer
X-MSMail-Priority: Normal
Reply-To: "eLe" <petruschan@realink.com.hk>
Newsgroups: borland.public.jbuilder.java.api