Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Direct computation of integer limits in K&R2?

Thread Tools

Direct computation of integer limits in K&R2?

Joe Wright
Posts: n/a
CBFalconer wrote:
> Ioannis Vranos wrote:
> ... snip ...
>> OK it is allowed, but is there any existing system where the value
>> ranges of signed int and unsigned int are different?

> Yes. Consider a 16 bit system. INT_MAX is 32767. INT_MIN is
> -32768 (or -32767). UINT_MAX is 65536 (UINT_MIN is naturally 0).
> It is allowable to reserve the value that would represent -32768 to
> indicate a special condition, such as uninitialized. Or, for a 1's
> complement machine, the bit pattern for -0 is forbidden.

Off by one.. 65536 takes 17 bits. Happy St. Paddy's.

Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Function for direct conversion integer > slv VHDL 2 12-25-2012 07:22 PM
where can I find good samples for efficient computation of matrix multiplication? walala VHDL 2 03-24-2010 10:06 AM
GPS : Basic pseudo-distance computation le Cl? VHDL 15 04-11-2009 09:22 AM
"Symbolic computation" Jesper Sahner Java 3 12-06-2004 10:41 AM