Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Fri, 12 Nov 2004 13:42:41 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: drand48() (and erand48) returns only zeros Message-ID: <20041112184241.GE28975@trixie.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20041112154151 DOT 37720 DOT qmail AT web52604 DOT mail DOT yahoo DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i On Fri, Nov 12, 2004 at 07:35:29PM +0100, Teun Burgers wrote: >meadmaker1066-cyg >>drand48 and erand48 return only 0.0 no matter how many times I call >>them. > >Indeed. Calling srand48 to set the seed helps, but should not be >necessary. From the linux man page: The srand48(), seed48() and lcong48() functions are initialization functions, one of which should be called before using drand48(), lrand48() or mrand48(). The functions erand48(), nrand48() and jrand48() do not require an initialization function to be called first. From the Single Unix Specification V2: The srand48(), seed48(), and lcong48() functions are initialization entry points, one of which should be invoked before either drand48(), lrand48(), or mrand48() is called. (Although it is not recommended practice, constant default initializer values shall be supplied automatically if drand48(), lrand48(), or mrand48() is called without a prior call to an initialization entry point.) The erand48(), nrand48(), and jrand48() functions do not require an initialization entry point to be called first. So, it is a bug as far as SUSv2 is concerned. The best way to get this fixed is to report it to the newlib mailing list. Newlib is where cygwin gets its math functions. newlib at sourceware dot org . -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/