public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug manual/7003] New: description of maximum value of random and random_r
@ 2008-11-04 11:29 bruno at clisp dot org
2008-11-04 11:31 ` [Bug manual/7003] " bruno at clisp dot org
2008-11-06 15:46 ` rjones at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: bruno at clisp dot org @ 2008-11-04 11:29 UTC (permalink / raw)
To: glibc-bugs
The description of the function random (and random_r later on that page says that
"The value returned ranges from 0 to RAND_MAX."
POSIX <http://www.opengroup.org/susv3/functions/random.html> says that the
value ranges from 0 to 2^{31}-1. So glibc's statement is right for glibc systems,
where RAND_MAX == 2^{31}-1. But it tricks programmers into writing code like
double from_0_to_1 = (double) random () / ((double) RAND_MAX + 1.0);
where
double from_0_to_1 = (double) random () / 2147483648.0;
would be correctly portable to other POSIX systems.
Find attached a doc fix.
--
Summary: description of maximum value of random and random_r
Product: glibc
Version: 2.8
Status: NEW
Severity: normal
Priority: P2
Component: manual
AssignedTo: roland at gnu dot org
ReportedBy: bruno at clisp dot org
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: i686-suse-linux-gnu
GCC host triplet: i686-suse-linux-gnu
GCC target triplet: i686-suse-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=7003
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug manual/7003] description of maximum value of random and random_r
2008-11-04 11:29 [Bug manual/7003] New: description of maximum value of random and random_r bruno at clisp dot org
@ 2008-11-04 11:31 ` bruno at clisp dot org
2008-11-06 15:46 ` rjones at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: bruno at clisp dot org @ 2008-11-04 11:31 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From bruno at clisp dot org 2008-11-04 11:29 -------
Created an attachment (id=3040)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=3040&action=view)
doc correction
--
http://sourceware.org/bugzilla/show_bug.cgi?id=7003
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug manual/7003] description of maximum value of random and random_r
2008-11-04 11:29 [Bug manual/7003] New: description of maximum value of random and random_r bruno at clisp dot org
2008-11-04 11:31 ` [Bug manual/7003] " bruno at clisp dot org
@ 2008-11-06 15:46 ` rjones at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: rjones at redhat dot com @ 2008-11-06 15:46 UTC (permalink / raw)
To: glibc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |rjones at redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=7003
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-06 15:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-04 11:29 [Bug manual/7003] New: description of maximum value of random and random_r bruno at clisp dot org
2008-11-04 11:31 ` [Bug manual/7003] " bruno at clisp dot org
2008-11-06 15:46 ` rjones at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).