Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jan 1995 12:53:57 -0500
From:      Thomas David Rivers <ponds!rivers@dg-rtp.dg.com>
To:        freebsd-bugs@freefall.cdrom.com, freebsd-hackers@freefall.cdrom.com
Subject:   drand48 problems persist.
Message-ID:  <199501301753.MAA02933@ponds.UUCP>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199501301753.MAA02933>