delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/06/14:17:55

Date: Fri, 6 Jun 1997 14:14:53 -0400 (EDT)
From: "Art S. Kagel" <kagel AT ns1 DOT bloomberg DOT com>
To: Real Email in Sig! <nospam AT miyares DOT slip DOT duq DOT edu>
Cc: djgpp AT delorie DOT com
Subject: Re: how to convert float ->int?
In-Reply-To: <5n4gt3$avg@news.duq.edu>
Message-Id: <Pine.D-G.3.91.970606141323.12912N-100000@dg1>
Mime-Version: 1.0

On 4 Jun 1997, Real Email in Sig! wrote:

> POULAIN Vincent (vpoulain AT club-internet DOT fr) wrote:
> : Only if you want the integer part of your float.
> : If you want a rounded value, this will not work of course :-)
> 
> How about a=(b+0.5); for a rounded answer?  Seems right, but I've been
> wrong on easier stuff before.

  a=(b+0.5005)  is better to handle rounding of values not exactly 
representable in IEEE float formats.

Art S. Kagel, kagel AT bloomberg DOT com

- Raw text -


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