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

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
Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=4KMZOEcsQzk8UdHfCvBRv16AXbwNzCFG0RsNaA6uQcCuR3RTbhsBzeE18EMsB6AzR2E+FhkS/qu+SYYddFI+TuMDv2KjdKRT65pLGk8xCQiB3HDppxWfa8FK6eV9zA/b0i3H+v7XdaLC8GMlajLlgaWA+DOcdYZ2gYSJayzY3Ew= ;
Message-ID: <20041112183543.75242.qmail@web52607.mail.yahoo.com>
Date: Fri, 12 Nov 2004 10:35:42 -0800 (PST)
From: <meadmaker1066-cyg AT yahoo DOT com>
Reply-To: meadmaker1066-cyg AT yahoo DOT com
Subject: Re: drand48() (and erand48) returns only zeros
To: cygwin AT cygwin DOT com
In-Reply-To: <Pine.GSO.4.61.0411121252480.1111@slinky.cs.nyu.edu>
MIME-Version: 1.0

Thanks for the prompt reply!

At 12:55 PM 11/12/2004 -0500, you wrote:
>If you're using C++, why use stdio functions?

The program has some modules from an older C program
and some from a C++ program. I just hadn't converted
all of the code. I left the headers in because in my
finished program I'd like to use both modules without
editing (plus my own new modules, which I could write
in either). 

But for testing purposes I just stripped out the
program body except for the loop printing the drand48
and the includes except

<iostream>, <math.h>, and namespace std; 

and tried it once with cout and a second time with
printf (i.e. the code below, compile and run then
comment out cout and uncomment printf compile and run)

so the ENTIRE program is now
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc,char* argv[]){
  for (int i=0; i < 10; i++){
    cout <<drand48()<<endl;
    //printf("%lf\n",drand48());
  }
  return 0;
}


and in both cases it's still just zeros!

Any other thoughts?
Thank you!
Robert


>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/

- Raw text -


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