delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/01/13:15:58

Date: Sun, 1 Aug 1999 11:26:35 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Clemens Valens <c DOT valens AT mindless DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: how about "more" random ?
In-Reply-To: <933323259.1410@www.remarq.com>
Message-ID: <Pine.SUN.3.91.990801112523.20304J-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Fri, 30 Jul 1999, Clemens Valens wrote:

> I think the difference is due to limited wordlength, which
> means rounding errors and overflow. For instance, when you
> multiply by 100 before deviding, you can have an overflow.

In principle, yes; but not in this case.  The largest value that
rand() can return is approximately 2e9, and multiplying it by 100
after conversion to a double will never overflow, since even 1e308
won't overflow a double.

- Raw text -


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