gmp_and operation ???

Priti Solanki pritiatwork at gmail.com
Sat Feb 6 08:57:16 CET 2010


Well i don't understand why you said it's non-gmp problem...!!  anywayz

following is the PHP code

$m_string='0010';
$c_string='0011';
$andresult=gmp_and($m_string,$c_string);
echo base_convert(8,10,2);
echo '<br> get resource type'.get_resource_type($andresult);
echo '<br/>Result: '. gmp_strval($andresult);

and i am using gmp_and NOT gmp_add....
this is not working this is sure... as i am running PHP 5.3.1 in which
gmp.dll is available ... and please also note that when i change

$m_string='1000';
$c_string='1000';

the output of gmpand() is correct !! this is what i am amazing at... that's
the reason i say i might be missing something....


On Fri, Feb 5, 2010 at 5:16 PM, Torbjorn Granlund <tg at gmplib.org> wrote:

>  Priti Solanki <pritiatwork at gmail.com> writes:
>
>  Consider following example>
>
>  $m_string='0000';
>  $c_string='0011';
>
>  $andresult=gmp_add($m_string,$c_string);
>
>  echo '<br/>Result: '. gmp_strval($andresult);
>
>  the output is "9"
>
>  I need the binary output of above $andresult .I think this is gmp val but
> if
>  i do strval($andresult,2) it show be binary of 9 not the and operation
>  result ... if not wrong the and output ashould be '0000'
>
>  i have to perform bitwise and for 288 bits but gmp is not returning me the
>  expected output in 4 bits !!!
>
>  Am i wrong somewhere?
>
> I don't know what system you're using, but it surely isn't GMP directly.
> Please let us not discuss this non-GMP problem here.
>
> --
> Torbjörn
>


More information about the gmp-discuss mailing list