X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: eplmst AT lu DOT erisoft DOT se (Martin Stromberg) Newsgroups: comp.os.msdos.djgpp,comp.lang.c++ Subject: Re: Weird double problem?! Followup-To: comp.os.msdos.djgpp,comp.lang.c++ Date: 10 Apr 2002 08:00:52 GMT Organization: Ericsson Erisoft AB, Sweden Lines: 25 Message-ID: References: <142c67c0 DOT 0204092338 DOT 1ce7acb3 AT posting DOT google DOT com> NNTP-Posting-Host: lws256.lu.erisoft.se X-Newsreader: TIN [version 1.2 PL2] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Taras (tagas96 AT hotmail DOT com) wrote: : Just doing some basic programming for maths, and something really : weird happened. I'm using RHIDE 1.4.9 w/ djgpp 2.03. I have this : line in my : program: : const double stepSize; : stepSize = 0.1; : when i step through the program and watch the variable step size, when : it : is assigned the value of 0.1, in the watch window it says the value is : 0.10000000000000001. I don't think it has something to do with the : displaying of the number, because when I store the result of : 1/stepSize : into an integer variable, the value of that variable is 9 (when it : should be : 10) Does anyone know where the last digit came from? Yes. Try to write 0.1 in binary notation and you'll find out. Right, MartinS