From owner-freebsd-hackers Wed Feb 1 22:28:56 1995 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id QAA07218 for hackers-outgoing; Wed, 1 Feb 1995 16:26:02 -0800 Received: from dg-rtp.dg.com (dg-rtp.rtp.dg.com [128.222.1.2]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id QAA07211 for ; Wed, 1 Feb 1995 16:25:44 -0800 Received: by dg-rtp.dg.com (5.4R2.01/dg-rtp-v02) id AA14844; Wed, 1 Feb 1995 19:25:02 -0500 Received: (rivers@localhost) by ponds.UUCP (8.6.9/8.6.5) id MAA02933; Mon, 30 Jan 1995 12:53:57 -0500 Date: Mon, 30 Jan 1995 12:53:57 -0500 From: Thomas David Rivers Message-Id: <199501301753.MAA02933@ponds.UUCP> To: freebsd-bugs@freefall.cdrom.com, freebsd-hackers@freefall.cdrom.com Subject: drand48 problems persist. Sender: hackers-owner@freebsd.org Precedence: bulk I know several people have indicated they are unable to reproduce my reported problems about drand48 (on FreeBSD 2.0R). However, I'm unable to get drand48 to work on any machine where 2.0R is installed. Here's an example script where I ran the test on a Pentium PCI machine, running stock 2.0R (I'm assuming printf() blew up because it was handed a completely invalid floating pt. number): If anyone has an idea as to what's happening here; don't hesitate to let me know. - Thanks - - Dave Rivers - p.s. I note that I can compile this with the -lm (to get the math libraries) *or* without the -lm, since drand48() is defined in libc.a. Thus, I don't believe this has anything to do with the math libraries (sun or otherwise.) ------------------------- typescript --------------------------- Script started on Mon Jan 30 12:57:11 1995 [numb.pc.sas.com]$ cat t.c extern double drand48(); main() { int i; double d; for(i=0;i<3072;i++) { d = drand48(); if(d >= 1.0) { printf("%lf is greater than 1.0\n", d); } } } [numb.pc.sas.com]$ cc -g t.c -lm [numb.pc.sas.com]$ ./a.out 25982.000000 is greater than 1.0 55082.000000 is greater than 1.0 23156.000000 is greater than 1.0 29267.000000 is greater than 1.0 20885.000000 is greater than 1.0 Floating exception - core dumped [numb.pc.sas.com]$ gdb ./a.out GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.11 (i386-unknown-freebsd), Copyright 1993 Free Software Foundation, Inc... (gdb) run Starting program: /tmp/./a.out 25982.000000 is greater than 1.0 55082.000000 is greater than 1.0 23156.000000 is greater than 1.0 29267.000000 is greater than 1.0 20885.000000 is greater than 1.0 Program received signal SIGFPE (8), Floating point exception 0x806d08a in L445 () (gdb) where #0 0x806d08a in L445 () #1 0x8087060 in _GLOBAL_OFFSET_TABLE_ () #2 0x8066abc in cvt () #3 0x8065932 in L227 () #4 0x8064246 in printf.so () #5 0x15f7 in main () at t.c:12 (gdb) quit >The program is running. Quit anyway (and kill it)? (y or n) y [numb.pc.sas.com]$ Script done on Mon Jan 30 12:57:34 1995