|  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
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: 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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
7 + 19 = ?
Subscribe to this entry?

 [2012-04-05 21:21 UTC]
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() (, 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).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-13 07:28 UTC]
-Status: Open +Status: Analyzed -Type: Bug +Type: Documentation Problem
 [2013-05-13 07:28 UTC]
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]
Automatic comment from SVN on behalf of cmb
Log: Fix #61643: gmp_nextprime and gmp_dcdext behavior differences
 [2018-04-29 11:14 UTC]
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-04-29 11:14 UTC]
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]
Automatic comment on behalf of cmb
Log: Fix #61643: gmp_nextprime and gmp_dcdext behavior differences
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jul 28 16:01:23 2021 UTC