www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/15/09:00:41

From: Paul Shirley <Paul AT chocolat DOT obvious DOT fake DOT foobar DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Minimum positive floating point?
Date: Mon, 13 Jul 1998 18:52:47 +0100
Organization: wot? me?
Lines: 28
Message-ID: <abdA1BAvlkq1Ewe+@foobar.co.uk>
References: <35A134D9 DOT FA633143 AT writeme DOT com>
NNTP-Posting-Host: chocolat.foobar.co.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <35A134D9 DOT FA633143 AT writeme DOT com>, Flavio Poletti
<poletti AT writeme DOT com> writes

MINFLOAT is to be the smallest normalised +ve float value. Its not
possible to store a smaller number *and* normalise it.

>float f1 = MINFLOAT, f2;
>f2 = f1/2;
>cout << f1 << "     " << f2;
>
>will show that f1 is greater than f2; a more closer look to the binary
>representation of f1 and f2 shows that f1 is surely a
>normalized-mantissa number, while f2 is not (I won't bother you all with
>extremely low-level representations, be calm!-).

Because f1 was the smallest legal number, after this f2 will round down
to zero (since it cannot be expressed as a normalised float). zero is
stored with the special pattern 0x00000000.
http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html explains
everything you need to know.

>Considering that in DJGPP it holds that sizeof(float) == sizeof(unsigned
>char), executing the next four lines:

Untrue. sizeof(uchar)==1, sizeof(float)==4... 

---
Paul Shirley: my email address is 'obvious'ly anti-spammed

- Raw text -


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