ID:               15835
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         *Math Functions
 Operating System: Linux - Red Hat 7.2
 PHP Version:      4.1.2
 New Comment:

This bug has been fixed in CVS.

it was a minor (but obviously crippling) typo. instead of doing
gmp_invert(a,b), it was doing gmp_invert(a,a). oops!


Previous Comments:
------------------------------------------------------------------------

[2002-03-04 10:50:41] [EMAIL PROTECTED]

Yes, I'm sure. The "Euclidean Algorithm" computes the greatest common
divisor but, the "Extended Euclidean Algorithm" give you the
multiplicative inverse.

The multiplicative inverse of 7 module 13 is 2 so, if I use
gmp_invert(7,13) it should return 2. 

Ok ?

------------------------------------------------------------------------

[2002-03-04 09:12:30] [EMAIL PROTECTED]

Are you sure that the extended Euclidean Algorithm does the same as
gmp_invert? The Euclidean Algorithm computes the greatest common
divisor, gmp_invert doesn't seem to do that...
Anyway, gmp_invert seems to be broken. I can't get it to return
anything else than false.
So I ask you again: can you give me some human understandable data that
works or should work?

------------------------------------------------------------------------

[2002-03-04 07:30:06] [EMAIL PROTECTED]

gmp_invert() should return the multiplicative inverse (if exist) of a
number, module something.

It's the extended Euclidean algorithm. I wrote this code and I can give
you. I think there is something wrong to gmp_invert.

------------------------------------------------------------------------

[2002-03-03 06:42:28] [EMAIL PROTECTED]

I can't get gmp_invert() return anything other than false, but that
might be because I have no idea what gmp_invert() does :)
Can you supply some (human understandable) data that does work?

------------------------------------------------------------------------

[2002-03-02 14:20:49] [EMAIL PROTECTED]

Example:

$x =
gmp_init("0x00d2d025ec7e1dbb6d778a52394c988594c57b47d7327a3e676d3a5ca7a5af87c4153c80994cf781f6a9d4a2f0e66d04baffb0059853a8937a895f6d17e76950e1");
// mod
$y = gmp_init("6211846575289879599"); // value

$w = gmp_invert($y,$x);

The $w value should be :

6673516182899846998314488146047624198500176381239637064622226136275029334435034698239463153441869117173460635003602664197747901516108936488872273669129832

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/15835

-- 
Edit this bug report at http://bugs.php.net/?id=15835&edit=1

Reply via email to