delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/12/13:42:53

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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 <cgf-no-personal-reply-please AT cygwin DOT com>
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> <cn2vo9$tac$1 AT sea DOT gmane DOT org>
Mime-Version: 1.0
In-Reply-To: <cn2vo9$tac$1@sea.gmane.org>
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/

- Raw text -


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