delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/09/13:31:15

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Rounding doubles to ints
Date: 08 Jun 2000 19:37:11 -0700
Organization: Posted via Supernews, http://www.supernews.com
Lines: 32
Sender: nate AT mercury DOT bitbucket
Message-ID: <83snuneg14.fsf@mercury.bitbucket>
References: <39363d0a$0$8416$7f31c96c AT news01 DOT syd DOT optusnet DOT com DOT au> <39367A02 DOT 7EA47FC5 AT home DOT com> <Mxz%4.15948$k22 DOT 182202 AT flipper> <394042AA DOT 4ED5973 AT home DOT com>
X-Complaints-To: newsabuse AT supernews DOT com
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Robin Johnson <robbat2 AT home DOT com> writes:

> not neccesarily, say for example you have 
> 4.0, which, rounded off, will still be 4.0
> if you add .5 it will become 5.0 instead of 4.0

Umm, I believe the idea is "add 0.5 and truncate".  So 4.0 -> 4.5 ->
4.0 but 4.6 -> 5.1 -> 5.0.

> 
> Olaf van der Spek wrote:
> > 
> > "Robin Johnson" <robbat2 AT home DOT com> schreef in bericht
> > news:39367A02 DOT 7EA47FC5 AT home DOT com...
> > > To make it round up, add .4 to your number right before you round
> > > and to round down, subtract .4
> > 
> > Shouldn't that be + 0.5?
> 
> -- 
> Robin Hugh Johnson
> "Robbat2"
> QTOD: "I used to be an idealist, but I got mugged by reality."
> E-Mail     : robbat2 AT orbis-terrarum DOT net
> ICQ#       : 30269588 or 41961639
> Home Page  : http://www.orbis-terrarum.net
> Time Zone  : Pacific Daylight (GMT - 8)

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019