drand48() (and erand48) returns only zeros

meadmaker1066-cyg@yahoo.com meadmaker1066-cyg@yahoo.com
Fri Nov 12 18:35:00 GMT 2004


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/


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /