www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/20/23:40:57

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: list of djgpp compiler errors wanted!
Date: Tue, 19 Nov 1996 19:47:15 -0800
Organization: Three pounds of chaos and a pinch of salt
Lines: 22
Message-ID: <32927F43.33F8@cs.com>
References: <32905cab DOT 10273409 AT news DOT uu DOT se> <32927C64 DOT 4CFE AT cs DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp103.cs.com
Mime-Version: 1.0
To: martin DOT gumucio AT mcu DOT uu DOT se
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John M. Aldrich wrote:
> 
> int auks;
> auks = floor( 19.99 + 11.99 );

Oops - I hate it when I do that.  For maximum correctness, you need to
typecast the result of floor() to int here; otherwise you're just doing
the same thing that created the original problem.  That should read:

int auks;
auks = (int) floor( 19.99 + 11.99 );

Of course, if you do that you may as well get rid of floor() and just
typecast the result.  ;)

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |        fighteer AT cs DOT com         |
|    *  Proud user of DJGPP!  *    |   http://www.cs.com/fighteer   |
|    ObJoke:  If Bill Gates were a robber, not only would he        |
|     shoot you, but he'd send you a bill for the bullets.          |
---------------------------------------------------------------------

- Raw text -


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