This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: drand48() (and erand48) returns only zeros


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]