PHP
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

gmp_init> <gmp_gcdext
Last updated: Fri, 26 Dec 2008

view this page in

gmp_hamdist

(PHP 4 >= 4.0.4, PHP 5)

gmp_hamdistDistance de Hamming

Description

int gmp_hamdist ( resource $a , resource $b )

Retourne la distance de Hamming entre a et b . Les deux paramètres doivent être strictement positifs.

Liste de paramètres

a

Il peut être soit une ressource GMP, soit une chaîne numérique qu'il est possible de convertir plus tard en un nombre.

Doit être positif.

b

Il peut être soit une ressource GMP, soit une chaîne numérique qu'il est possible de convertir plus tard en un nombre.

Doit être positif.

Valeurs de retour

Une ressource GMP.

Exemples

Exemple #1 Exemple avec gmp_hamdist()

<?php
$ham1 
gmp_init("1001010011"2);
$ham2 gmp_init("1011111100"2);
echo 
gmp_hamdist($ham1$ham2) . "\n";

/* hamdist est équivalent à : */
echo gmp_popcount(gmp_xor($ham1$ham2)) . "\n";
?>

L'exemple ci-dessus va afficher :

6
6



add a note add a note User Contributed Notes
gmp_hamdist
There are no user contributed notes for this page.

gmp_init> <gmp_gcdext
Last updated: Fri, 26 Dec 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites