php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #61643 gmp_nextprime and gmp_dcdext behavior differences
Submitted: 2012-04-05 21:21 UTC Modified: 2018-04-29 11:14 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mattficken@php.net Assigned: cmb (profile)
Status: Closed Package: GNU MP related
PHP Version: 5.4.1RC1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mattficken@php.net
New email:
PHP Version: OS:

 

 [2012-04-05 21:21 UTC] mattficken@php.net
Description:
------------
022.phpt which tests gmp_gcdext() and gmp_nextprime.phpt which tests gmp_nextprime() fail on Windows but pass on Linux.
 
The returned value of both of those functions in some cases doesn’t match the expected value(in some cases it does).
 
In example #1 in the documentation for gmp_nextprime() (http://us3.php.net/gmp_nextprime), gmp_nextprime(-1000) returns -997  however on Linux it returns 2, which is what the test expects so the test passes. 

Not only is this a behavior difference between Windows and Linux but is not what the documentation states ( gmp_nextprime(-1000) => -997 not 2).


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-13 07:28 UTC] ab@php.net
-Status: Open +Status: Analyzed -Type: Bug +Type: Documentation Problem
 [2013-05-13 07:28 UTC] ab@php.net
I'm using this snippet to test on both Windows and Linux

#include <gmp.h>

int main (void) {

	mpz_t p;

	mpz_init_set_str(p, "-1000", 10);

	mpz_nextprime(p, p);
	gmp_printf("mpz_nextprime : %Zd\n", p);

	return 0;
}

It looks like the correct answer is 2, on both windows mpir 2.5.1 and 2.6.0 and 
linux with 
gmp. The tests are also pass now, the doc is wrong.
 [2018-04-29 11:14 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=344880
Log: Fix #61643: gmp_nextprime and gmp_dcdext behavior differences
 [2018-04-29 11:14 UTC] cmb@php.net
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-04-29 11:14 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:05 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=620e68a7f08e4ea754d8a22d1f5685ea1743d9f0
Log: Fix #61643: gmp_nextprime and gmp_dcdext behavior differences
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 19:01:31 2024 UTC