Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
manual:chapter3:reals [2017/06/11 17:02] smartin created |
manual:chapter3:reals [2019/11/04 16:06] jojo1973 More reformatting |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Numbers | + | ===== Basic numbers |
- | A number in newRPL is represented as exact or approximate. | + | ==== Approximate versus Exact ==== |
+ | |||
+ | A number in **newRPL** is represented as exact or approximate. | ||
Here are some examples: | Here are some examples: | ||
- | | **Approximate Numbers** | **Exact Numbers** | | + | ^ Approximate Numbers |
- | | 1. | 1 | | + | | '' |
- | | 1.007. | 1.007 | | + | | '' |
- | | 1.007.e-10 | 1.007e-10 | | + | | '' |
Arithmetic performed on numbers takes into account the operands (exact or approximate) and results are displayed accordingly. | Arithmetic performed on numbers takes into account the operands (exact or approximate) and results are displayed accordingly. | ||
- | For example, | + | For example, |
+ | 2: 1 | ||
+ | 1: 3 | ||
+ | …………………………………………………………………………………… | ||
+ | / | ||
+ | </ | ||
+ | 2: 1 | ||
+ | 1: 2 | ||
+ | …………………………………………………………………………………… | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Numbers in other bases ==== | ||
+ | |||
+ | Numbers in different bases can be entered by preceding the value with a ''#'' | ||
+ | |||
+ | A quicker method to enter these numbers consists in using the **base cycler**: simply start keying the number in the preferred base then press **RS< | ||
+ | |||
+ | The base cycler is smart enough to skip bases if the keyed number contains illegal digits. For example, if there' | ||
+ | |||
+ | If the number is already on the stack the base cycler will display all four bases in succession, provided the number is integer. | ||
+ | |||
+ | Another option is the BASE menu (**RS-3**): in its first page the soft key will give access to the aforementioned base cycler and four __non-programmable__ base conversion tools which act on the number on the edit line or the first level of the stack. | ||
+ | |||
+ | Arithmetic can be done on numbers in different bases with the result displayed as the base of the first argument. | ||
+ | |||
+ | In other words, it is assumed that **non base-10 numbers are signed, 64-bits integers**. Of these 64 bits, the least significant 63 bits store the magnitude and the 64th most significant bit stores the sign ('' | ||
+ | |||
+ | For example: < | ||
+ | 2: # | ||
+ | 1: #EEh | ||
+ | …………………………………………………………………………………… | ||
+ | - | ||
+ | </ | ||
+ | |||
+ | Here are more examples of arithmetic operations in bases other than 10: | ||
+ | |||
+ | < | ||
+ | 2: #1101b | ||
+ | 1: #FFh | ||
+ | …………………………………………………………………………………… | ||
+ | + | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | 2: 256 | ||
+ | 1: #FFFFh | ||
+ | …………………………………………………………………………………… | ||
+ | - | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | 2: # | ||
+ | 1: # | ||
+ | …………………………………………………………………………………… | ||
+ | * | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | 2: #7h | ||
+ | 1: 2 | ||
+ | …………………………………………………………………………………… | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | 2: #2h | ||
+ | 1: 63 | ||
+ | …………………………………………………………………………………… | ||
+ | ^ | ||
+ | </ | ||
+ | |||
+ | ==== Setting the word size ==== | ||
+ | |||
+ | If there is a need to work with different word sizes **newRPL** provides a dedicated set of **bit operations**: | ||
- | ---- | + | The word size can be set using the command '' |
+ | < | ||
+ | « 7 STWS | ||
+ | 120 4 BMUL | ||
+ | » | ||
+ | </ | ||
+ | The result is '' | ||
+ | ==== Bit operations ==== | ||
+ | ^ Command ^ Purpose ^ Example ^ | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' |