🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #83

Wrong calc with Double

#83
From: Jose Maria Sanmartin
Date: Wed, 08 Mar 2006 20:27
15 lines
1253 bytes
Hello,

Does someone know why the following code give wrong results?

*************************
   Double import = -1154.34;
   import +=  945.67;
   import += 208.67;
   MessageBox.Show(import.ToString());
*********************************
In the MessageBox I get -2.8421709430404E-14 instead of 0.

Thanks,

Jose Maria Sanmartin 
Technical Details
Message-ID: <440f3e44@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,fe16f5826c706566,start
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Jose Maria Sanmartin" <chema@nospamplease.com>
From: "Jose Maria Sanmartin" <chema@nospamplease.com>
Newsgroups: borland.public.csharpbuilder.language.csharp
Subject: Wrong calc with Double
Date: Wed, 8 Mar 2006 21:27:51 +0100
Lines: 17
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 217.127.128.199
Message-ID: <440f3e44@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1141849668 217.127.128.199 (8 Mar 2006 12:27:48 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail