Question regarding 8/16-bits 2's complement numbers

This is a discussion on Question regarding 8/16-bits 2's complement numbers within the C Programming forums, part of the General Programming Boards category; Hi, Can someone please explain to me whats the range of 8-bits two's complement numbers in binary, decimal and hex? ...

  1. #1
    mobius
    Guest

    Question Question regarding 8/16-bits 2's complement numbers

    Hi,
    Can someone please explain to me
    whats the range of 8-bits two's complement numbers in binary, decimal and hex?


    thank you in advance

  2. #2
    mobius
    Guest

    Talking

    I've opened the limit.h file as you said, and its soemthing like this.
    =============================
    #define CHAR_BIT 8 /* bits per char */
    #define CHAR_MAX 127 /* max value of a char */
    #define CHAR_MIN -128 /* min value */
    #define SCHAR_MAX CHAR_MAX /* chars are signed */
    #define SCHAR_MIN CHAR_MIN
    #define UCHAR_MAX 255 /* for unsigned chars */
    #define SHRT_MAX 32767 /* max value of a short */
    #define SHRT_MIN (int)-32768
    #define USHRT_MAX 65535 /* unsigned short */

    /* 32 bit chips have 32 bit integers */

    #if defined(m68k) || defined(i8086) && defined(FLAT_MODEL)
    #define INT_MAX 2147483647 /* max value of int */
    #define INT_MIN (int)-2147483648 /* min value */
    #define UINT_MAX 4294967295 /* unsigned int */
    #else /* not 32 bit chips */
    #define INT_MAX 32767 /* max for int */
    #define INT_MIN (int)-32768 /* min for int */
    #define UINT_MAX 65535 /* unsigned int */
    #endif /* 32 bit chips */
    #define LONG_MAX 2147483647 /* max value of long */
    #define LONG_MIN (long)-2147483648 /* min value */
    #define ULONG_MAX 4294967295 /* unsigned long */

    =========================================

    How do i get the 16-bit 2's complement numbers as well?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question (floating numbers)
    By Mak in forum C Programming
    Replies: 9
    Last Post: 10-14-2003, 09:05 PM
  2. the definition of a mathematical "average" or "mean"
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 12-03-2002, 10:15 AM
  3. Question on the Bits...
    By CEOSion in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-21-2002, 11:27 PM
  4. Newbie question on numbers.
    By thes in forum C++ Programming
    Replies: 14
    Last Post: 06-17-2002, 07:18 AM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 05:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21