## Signed Integer Representation Model

## written by Crystal Barchet and Teresa Carrigan

## Run model in your browser

- What is it?
- How it works
- How to use it
- Things to notice
- Things to try
- Extending the model
- NetLogo features
- Related models
- Credits and References
- For more information
- Run model in your browser
- Download the model
- Single webpage version

## WHAT IS IT?

This model demonstrates the three formats for storing a signed decimal integer as an pattern of eight bits: signed magnitude, one's complement, and two's complement.

## HOW IT WORKS

First, the sign is separated from the decimal digits. The decimal digits are then converted to unsigned binary, and padded to eight bits. If the sign is positive, then this is the answer, no matter which format is being used. When using signed magnitude, a negative number simply changes the left-most bit from a zero to a one. When using one's complement, a negative number simply inverts each bit. That is, each one becomes a zero, and each zero becomes a one. When using two's complement, first the one's complement is determined, and then we add one to get the answer.

HomeApplets on this website were written by Teresa Carrigan in 2004, for use in computer science courses at Blackburn College, with the exception of the Fireworks applet. The applets made with NetLogo require Java 1.4.1 or higher to run. The applets made with NetBeans require Java 1.4.2 or higher to run. Applets might not run on Windows 95 or Mac OS 8 or 9. You may obtain the latest Java plugin from Sun's Java site.