delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/09/16:31:45

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: float
Date: Sat, 09 May 1998 16:17:08 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 35
Message-ID: <3554B9C4.3DC9@cs.com>
References: <6j2crt$i0$1 AT orudios DOT magnet DOT at>
NNTP-Posting-Host: ppp112.cs.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Elias Pschernig wrote:
> 
> I'm working on a game, which uses "float"-type for
> x- and y-coordinates of an object. Sometimes the
> object starts moving very, er, bulky, and i found out,
> this is the case, when either y or x coordinate go
> over 100000; the larger, the more bulky the movement.
> I'm now sure this has to do with the float-type, but
> it's very strange, because there occurs no other
> error, i.e. the position always is correct, even with
> large numbers, just it moves not smoothly any more.
> 
> I would like it very much, if somebody could
> explain to me how DJGPP's float-type works.
> (also if it's the i86's float-type)

'float' is a 32-bit type, with 7 digits of precision.  If you get higher
than that, you'll lose precision in the lower digits.  For larger
calculations, use 'double', which is 64 bits and has 15 significant
digits.

I'm not an expert on floating point values, but DJGPP's floats conform
to the IEEE specifications and to the i86's floating point registers.

-- 
John M. Aldrich <fighteer AT cs DOT com> - ICQ UIN# 7406319

* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
  causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
  again.
* It doesn't necessarily do it in chronological order, though.
 
                                       --- Douglas Adams

- Raw text -


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