Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Fri, 12 Nov 2004 12:55:04 -0500 (EST)
From: Igor Pechtchanski <pechtcha@cs.nyu.edu>
Reply-To: cygwin@cygwin.com
To: meadmaker1066-cyg@yahoo.com
cc: cygwin@cygwin.com
Subject: Re: drand48() (and erand48) returns only zeros
In-Reply-To: <20041112154151.37720.qmail@web52604.mail.yahoo.com>
Message-ID: <Pine.GSO.4.61.0411121252480.1111@slinky.cs.nyu.edu>
References: <20041112154151.37720.qmail@web52604.mail.yahoo.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 <stdlib.h>
> #include <cmath>
>
> #include <iostream>
           ^^^^^^^^^^
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@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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/

