delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/01/15:15:10

From: "Jason" <j_ring AT optusnet DOT com DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Rounding doubles to ints
Date: Thu, 1 Jun 2000 20:40:52 +1000
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Lines: 15
Message-ID: <39363d0a$0$8416$7f31c96c@news01.syd.optusnet.com.au>
NNTP-Posting-Host: 198.142.183.67
X-Trace: 959855883 news01.syd.optusnet.com.au 8416 198.142.183.67
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi all,

Just a quick question - is it standard practice for a c/c++ compiler (such
as DJGPP) to round up-always, down-always or to the nearest-integer when
casting a double to an int?  If there is no standard for rounding with
regard to casting doubles to ints, would it be best to use floor(), ceil()
and round() just in case (for cross-compiler compatibility)?

Thanks,

Jase.




- Raw text -


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