Bug #70575 [NEW]: gmp_random() doc wrong
| From: | rainer dot jung at kippdata dot de | Date: | Thu, 24 Sep 2015 20:40:38 +0000 |
| Subject: | Bug #70575 [NEW]: gmp_random() doc wrong | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-12777@lists.php.net to get a copy of this message | ||
From: rainer dot jung at kippdata dot de
Operating system: Any
PHP version: 7.0.0RC3
Package: Documentation problem
Bug Type: Bug
Bug description:gmp_random() doc wrong
Description:
------------
Docs at http://php.net/manual/en/function.gmp-random.php
say:
Generate a random number. The number will be between zero and the number
of bits per limb multiplied by limiter.
...
Generally, the number of bits in a limb is either 16 or 32, but this is
not guaranteed.
The errors are:
- "number of bits per limb multiplied by limiter" is not the upper
boundary of the random number, instead it is 2**n-1, where n is "number
of bits per limb multiplied by limiter"
- number of bits in a limb is in most cases 64 or 32, not 32 or 16.
Suggested correction (partly taken from docs of gmp_random_bits()):
Generate a random number. The number will be between 0 and (2 ** n) - 1,
where n is the number of bits per limb multiplied by limiter.
...
Generally, the number of bits in a limb is either 64 or 32, but this is
not guaranteed.
If you mind: where are the sources for the man pages (git URL or
similar)? I could then attach a patch.
--
Edit bug report at https://bugs.php.net/bug.php?id=70575&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70575&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70575&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70575&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70575&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70575&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70575&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70575&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70575&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70575&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70575&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70575&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70575&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70575&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70575&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70575&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70575&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70575&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70575&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70575&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70575&r=mysqlcfg