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

Message-Id: <200006090809.LAA03361@mailgw1.netvision.net.il>
Date: Fri, 09 Jun 2000 11:07:53 +0200
X-Mailer: Emacs 20.6 (via feedmail 8.1.emacs20_6 I) and Blat ver 1.8.5b
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
To: Robin Johnson <robbat2 AT home DOT com>
CC: djgpp AT delorie DOT com
In-reply-to: <394042AA.4ED5973@home.com> (message from Robin Johnson on Fri,
09 Jun 2000 01:04:08 GMT)
Subject: Re: Rounding doubles to ints
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>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Robin Johnson <robbat2 AT home DOT com>
> Newsgroups: comp.os.msdos.djgpp
> Date: Fri, 09 Jun 2000 01:04:08 GMT
> 
> 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

Did you actually try that?  If not, I suggest to try (and post the
program you use).

If you add 0.4, then (4.59 + 0.4) won't produce the right result (I'd
expect it to be rounded to 5, not 4).

My advice is just to use the library function, don't reinvent the
wheel.

- Raw text -


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