Hamilton LaboratoriesHamilton C shell 2012User guideSamples

bits.csh

Oregon Coast

bits.csh
Previous | Next

#  Calculate the number of bits required to represent a numeric value as
#  an integer.

#  Copyright (c) 1989-2012 by Hamilton Laboratories.  All rights reserved.

proc bits( n )
   return ceil(log2 (n + 1))
end

bits $argv

Previous | Next