It's very strange, because I still have the test failed.

ext/gmp/tests/021.php

The exactly broken thing is gmp_gcd(-1,0) that now returns -1 instead of 1. However you can see that return value of gmp_gcd(-2,2) now is not equal to gmp_gcd(2,-2). :(

Thanks. Dmitry.

Ilia Alshanetsky wrote:
Dmitry,

I've just tried to run the test on a patched 5.3 system and the test passes without any problems. Why is the test failing on your machine?


On 31-Jan-08, at 3:50 AM, Dmitry Stogov wrote:

Hi Ilia,

Probably your fix is not accurate, because it breaks ext/gmp/tests/021.phpt, however it shouldn't from my point of view.

BTW my math knowledge is not excellent.

Could you please take a look.
May be the fix should be done only for gmp_div_r() and shouldn't affect other functions.

Thanks. Dmitry.

Ilia Alshanetsky wrote:
iliaa        Wed Jan 30 18:27:04 2008 UTC
 Modified files:              (Branch: PHP_5_2)
   /php-src/ext/gmp    gmp.c     /php-src    NEWS   Log:
   MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st
 argument)
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.12&r2=1.49.2.2.2.13&diff_format=u
Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.12 php-src/ext/gmp/gmp.c:1.49.2.2.2.13
--- php-src/ext/gmp/gmp.c:1.49.2.2.2.12    Mon Dec 31 07:20:06 2007
+++ php-src/ext/gmp/gmp.c    Wed Jan 30 18:27:03 2008
@@ -552,6 +552,9 @@
    if (use_ui && gmp_ui_op) {
        if (allow_ui_return) {
long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
+            if (mpz_sgn(*gmpnum_a) == -1) {
+                long_result = -long_result;
+            }
        } else {
gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
        }
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1067&r2=1.2027.2.547.2.1068&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1067 php-src/NEWS:1.2027.2.547.2.1068
--- php-src/NEWS:1.2027.2.547.2.1067    Wed Jan 30 15:30:44 2008
+++ php-src/NEWS    Wed Jan 30 18:27:03 2008
@@ -8,6 +8,8 @@
  which to group by data is specified. (Ilia)
- Upgraded PCRE to version 7.6 (Nuno)
+- Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st argument).
+  (Ilia)
- Fixed bug #43954 (Memory leak when sending the same HTTP status code
  multiple times). (Scott)
- Fixed bug #43927 (koi8r is missing from html_entity_decode()).

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Ilia Alshanetsky


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to