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


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


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