FloatToTwosComplement:

Path: Math/MathUtils

% Converts a float to two's complement array. 
 For example:

   [1 1 1 0 0 1 0 1] = FloatToTwosComplement( -27, 8, 1 )
   [0 0 0 1 1 1 0 0] = FloatToTwosComplement(  28, 8, 1 )

 Type FloatToTwosComplement for a demo.
--------------------------------------------------------------------------
   Form:
   b = FloatToTwosComplement( f, n, bigEndian )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   f                       Float
   n                       Bits per word
   bigEndian               1 == big endian [msb...lsb] else
                           [lsb...msb]

   -------
   Outputs
   -------
   b                       Binary array

--------------------------------------------------------------------------

Back to the Math Module page