number_bin2hex Conversion number_hex2bin

Number >> Number > Conversion > number_frombary

number_frombary

Compute a number from a matrix of digits.

Calling Sequence

n = number_frombary ( d )
n = number_frombary ( d , basis )
n = number_frombary ( d , basis , order )

Parameters

basis :

a 1x1 matrix of floating point integers, the basis (default 2)

d :

a matrix of floating point integers, the digits

order :

a 1x1 matrix of strings, the order (default "littleendian")

n :

a 1x1 matrix of doubles

Description

Given a matrix of digits d(i), i=1,2,...,p, and a basis b, returns the "littleendian" number

n = d(p) + d(p-1)*b + d(p-2)*b^2 + ... + d(1)*b^(p-1)
If "bigendian" order is chosen, returns the number
n = d(1) + d(2)*b + d(3)*b^2 + ... + d(p)*b^(p-1)

Examples

n = number_frombary ( [1 0 0] ) // 4
basis = 2;
n = number_frombary ( [1 0 0] , basis ) // 4
n = number_frombary ( [1 0 0] , basis , "littleendian" ) // 4
n = number_frombary ( [0 0 1] , basis , "bigendian" ) // 4

Authors

number_bin2hex Conversion number_hex2bin