number

Number

Methods

hamming

(static) hamming(na, nb) → {number}

Computes the the hamming distance between two numbers; each number is assumed to be decimal representation of a binary number.

Example
hamming( 8, 8 );
// -> 0
hamming( 8, 15 );
// -> 3
hamming( 9, 15 );
// -> 2
Parameters
Name Type Description
na number

the first number.

nb number

the second number.

Returns

hamming distance between na and nb.

Type
number