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 12:55:04 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: meadmaker1066-cyg AT yahoo DOT com cc: cygwin AT cygwin DOT com Subject: Re: drand48() (and erand48) returns only zeros In-Reply-To: <20041112154151.37720.qmail@web52604.mail.yahoo.com> Message-ID: 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-ID: Content-Disposition: INLINE X-Scanned-By: MIMEDefang 2.39 On Fri, 12 Nov 2004, meadmaker1066-cyg wrote: > drand48 and erand48 return only 0.0 no matter how many > times I call them. The code works fine on the Linux > computers at school, and the compiler does not report > any errors or warnings. > [anip] > > #include > #include > > #include ^^^^^^^^^^ If you're using C++, why use stdio functions? > using namespace std; > > ... > > for(int i=0; i<10; i++){ > printf("%f\n",drand48()); In any case, try printf("%lf\n",drand48()); ^ > } > > In CygWin it produces a chain of 10 values "0.00000" > but in Linux it produces a chain of random numbers. If > I define an array of unsigned short integers and pass > it to erand48 I get the same behavior (I thought maybe > drand might be just resetting its internal storage). HTH, Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "The Sun will pass between the Earth and the Moon tonight for a total Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT -- 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/