From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e749bdf6fe4253aa X-Google-Attributes: gid103376,public From: dvdeug@x8b4e516e.dhcp.okstate.edu (David Starner) Subject: Re: Why no new posts ? Date: 2000/11/15 Message-ID: <8ut9n3$8a21@news.cis.okstate.edu>#1/1 X-Deja-AN: 695039262 References: <002001c04ec8$27db8ee0$b0375140@Fudge> Organization: Oklahoma State University User-Agent: slrn/0.9.6.3 (Linux) Reply-To: dstarner98@aasaa.ofe.org Newsgroups: comp.lang.ada Date: 2000-11-15T00:00:00+00:00 List-Id: On Tue, 14 Nov 2000 21:51:51 -0800, JF Harrison wrote: >This is a multi-part message in MIME format. Please don't send MIME to the newsgroup, especially not program binaries. >Want some posts? >How about some beginner level questions from my end. > >One in this post and another following. > >First off: >I got a Very strange error in dividing real numbers. I divided 12345670.0 >by 100.0 and got 123456.70313 as the answer! I have certainly able to have >flawless divisions but also isolated some code that will repeatably >demonstrate this. I still dont know what is wrong with the code; perhaps >you can tell me. First, for almost any question like this, we need to know which platform you're on and which compiler you're using. (Windows on ix86, I assume?) This may sound insulting, but do you know that real numbers are stored in binary? Division by powers of ten is not going to come out exactly right. Float also does not have very much precision. From what I'm looking at, float on the ix86 has 6 decimal digits of precision, which doesn't correspond to your numbers, because your numbers are _too_ correct. Still, you're using a low precision float type in base 2, which means division by 100.0 is not going to be exact, and you'll easily get visibly wrong answers. -- David Starner - dstarner98@aasaa.ofe.org http://dvdeug.dhis.org As centuries of pulp novels and late-night Christian broadcasting have taught us, anything we don't understand can be used for the purposes of Evil. -- Kenneth Hite, Suppressed Transmissions