delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/08/22:10:22

Date: Thu, 8 May 1997 22:10:02 -0400 (EDT)
From: Michael Phelps <morphine AT hops DOT cs DOT jhu DOT edu>
To: mac martin <jakie1132 DOT AT 12 DOT us DOT jeffco>
cc: djgpp AT delorie DOT com
Subject: Re: rounding double type
In-Reply-To: <33715231.6FD7@12.us.jeffco>
Message-ID: <Pine.GSO.3.95.970508220836.1072A-100000@hops.cs.jhu.edu>
MIME-Version: 1.0

On Wed, 7 May 1997, mac martin wrote:

> How do you round a double type number to the nearest whole number then
> convert it to and int?
> 

Simple:  (int)(x + 0.5)



						---Michael Phelps
						   morphine AT cs DOT jhu DOT edu


                               CH3
                               |
                               N
                             / |
                     ______/   |
                    /      \   CH2
             _____/         \__|__      
           //     \\        /  |  \\     
         //        \\______/___CH2 \\  
          \        /       \       /
           \______/         \_____/
          / ------ \       /      \
        OH           \   /         OH
                       O
 
                   Morphine



- Raw text -


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