www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/03/01:50:54

Date: Tue, 3 Dec 1996 08:40:30 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Joe Wright <wrightj AT exis DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Problems with DJGPP V2.01 - atof() function
In-Reply-To: <32A33C44.68FE@exis.net>
Message-ID: <Pine.SUN.3.91.961203083839.3181H-100000@is>
MIME-Version: 1.0

On Mon, 2 Dec 1996, Joe Wright wrote:

> the result 'wrong' but why are they different?  Why does i=(int)(f*100);
> yield a different result than f=f*100; i=(int)f; ?  Why?

Because the second one involves an extra store of an intermediate result 
into the float variable `f', which causes the result to be rounded, 
because a float is 32 bit while the FPU internally uses 80 bits.

- Raw text -


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