www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/06/09/17:09:43

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200206092109.g59L9dG05141@speedy.ludd.luth.se>
Subject: Re: Patches for building with gcc 3.1 - tests chunk
In-Reply-To: <3D03BEF4.78F989@phekda.freeserve.co.uk> "from Richard Dawe at Jun
9, 2002 09:47:48 pm"
To: djgpp-workers AT delorie DOT com
Date: Sun, 9 Jun 2002 23:09:39 +0200 (CEST)
X-Mailer: ELM [version 2.4ME+ PL78 (25)]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

According to Richard Dawe:
> actually need to cast the return value? It seems like we could just let C's
> implicit typecasting handle it, rather than forcing the cast. If I remove the
> cast, the warning goes away.
> 
> If there are no objections, I will change the following line in
> tests/libc/go32/signals.c from:
> 
>     urand = ((double)rand()) / RAND_MAX;
> 
> to:
> 
>     urand = rand() / RAND_MAX;
> 
> OK to commit that?

No. Try it in a little test program and you'll find out why.

Eli's suggestions were good. Either "urand = rand() * 1.0 / RAND_MAX;"
or "urand = rand() / (double)RAND_MAX;" should do the trick


Right,

						MartinS

- Raw text -


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