[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: precision of signed integers

This page is part of the web mail archives of SRFI 58 from before July 7th, 2015. The new archives for SRFI 58 contain all messages, not just those from before July 7th, 2015.



Aubrey Jaffer wrote:

A 16.bit unsigned integer is 16.bit wide.

Is the corresponding width signed integer 16.bit or 15.bit?


A 16-bit 2's-complement signed integer would have a value range from -32767 to 32768. The high bit would indicate whether it is positive or negative; a negative value would be the inverse of it's absolute value, plus one. Thus, -1 would be 1111111111111111, -32767 would be 1000000000000000, and 0 would be 0000000000000000 for both negative and positive values.

Joseph Osako


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.7 - Release Date: 2004-12-30