Halcyon Calc can manipulate integer numbers. This document has the following sections to help you work with integers on the calculator:

- Entering Integer Numbers
- Converting To Or From Integer Numbers
- Formatting Integer Numbers
- Manipulating Integer Numbers

# Entering Integer Numbers:

An integer number can be entered in one of four different forms:

- Decimal - In decimal mode, you use the usual digits 0 through 9. The number is expressed in base 10.
- Hexadecimal - In hexadecimal mode, you use the digits 0 through 9 and the letters A through F (which represent the numbers 10 through 15). The number is expressed in base 16.
- Octal - In octal mode, you use the digits 0 through 7. The number is expressed in base 8.
- Binary - In binary mode, you use the digits 0 and 1. The number is expressed in base 2.

In all cases, you start entering an integer by pressing the "#" button. All integers start with this symbol and indicates that the digits which follow should be interpreted as an integer. After the "#" symbol, you then hit the digits you want to enter, left to right in your number. The digits you enter depend on the base of the number you are entering. Note that if you are entering a hexadecimal number, the letters A through F must be entered in upper case. The calculator will not understand the number if you use lower case.

Finally, you add a single character to indicate the base of the number you are entering. Hit the "d" key to indicate the number is a decimal number. Use the "h" key to mark it as hexadecimal or the "o" key if it is octal. Finally, you use the "b" key to indicate the number should be interpreted as binary. Note that the character which controls the base of the number must be entered in lower case.

The calculator has an integer mode which controls which base is used for formatting integer numbers (see the formatting section for more information). But, you can omit the final character which specifies the base of the number you are entering if you are in that mode. So, if you enter a hexadecimal number, you do not have to put an "h" at the end of the number if you happen to be in HEX mode.

To demonstrate how to enter integers, imagine you want to enter the decimal number 452 as an integer. The following table describes how to do that in all of the four different bases supported:

**Decimal**- #452d**Hexadecimal**- #1C4h**Octal**- #704o**Binary**- #111000100b

Note that the number you see on the stack may not match exactly what you entered in some cases, because the word size may result in some digits not being shown. The word size and how it affects integers is explained in the formatting section.

# Converting To Or From Integer Numbers:

Often, you may have a real number on the stack which you would like to manipulate as an integer number. In that case, you can use the R→B operation from the Binary menu. This operation will take a real number from the top of the stack and pushes the equivalent integer onto the stack. Another way to accomplish this is to add "#0" to the real number on the stack. The + operation can take a real number and an integer number and produces an integer result. By adding an integer zero, you are effectively converting the real number to an integer.

The alternate conversion is possible also. If you have an integer at the top of the stack which you would like to convert to a real number, you can use the B→R operation from the Binary menu.

# Formatting Integer Numbers:

There are two key parameters which drive how an integer is formatted. Firstly, the base mode the calculator is in determines what base is used to display integers on the stack. The DEC, HEX, OCT and BIN operation from the Binary menu will set the calculator to the decimal, hexadecimal, octal or binary mode respectively.

The calculator also has a word size which determines how many binary digits are valid. By default, the calculator runs with a word size of 64 which means you can enter integer values between 0 and 2^{64}-1. The word size can be set to any number between 1 and 64 and you would use the STWS (SeT Word Size) operation from the Binary menu to set the work size. Push the new word size onto the stack as a real number and execute STWS. If you don't know what the word size is currently, execute the RCWS (ReCall Word Size) operation from the Binary menu. That operation will push the current word size onto the stack as a real number.

Regardless of the base you are in, the word size affects how many digits you will see. If you decrease the word size, integers on the stack may lose their upper digits and one digit may change value (upper bits in that digit were masked out). If you increase the word size, integers on the stack may regain their upper digits.

Because integers are the primary data manipulated by microprocessors/computers, a common use for integers on the calculator is to perform these kinds of calculations. If the computer you are working with has a 32 bit word size, then it is probably natural to set the word size on the calculator to match.

# Manipulating Integer Numbers:

There are many operations which you can use when working with integer numbers. The standard addition, subtraction, multiplication and division operations are obvious. Here are some links to reference material which are relevant for integer numbers:

- The Binary Menu has several useful operations for working with integer numbers. Here, you will find shift and rotate operations and the standard logic operations like and, or, exclusive or etc.
- A list of operations which take integer numbers can be found here.
- A list of operations which produce integer numbers can be found here.