122-32000 Parallax Inc, 122-32000 Datasheet - Page 420

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Appendix B: Accessing Math Function Tables
Appendix B: Accessing Math Function Tables
Log and Anti-Log Tables ($C000-DFFF)
The log and anti-log tables are useful for converting values between their number form and
exponent form.
When numbers are encoded into exponent form, simple math operations take on more
complex effects. For example ‘add’ and ‘subtract’ become ‘multiply’ and ‘divide,’ ‘shift-left’
becomes ‘square’ and ‘shift-right’ becomes ‘square-root,’ and ‘divide by 3’ will produce
‘cube root.’ Once the exponent is converted back to a number, the result will be apparent.
This process is imperfect, but quite fast.
For applications where many multiplies and divides must be performed in the absence of
many additions and subtractions, exponential encoding can greatly speed things up.
Exponential encoding is also useful for compressing numbers into fewer bits – sacrificing
resolution at higher magnitude. In many applications, such as audio synthesis, the nature of
signals is logarithmic in both frequency and magnitude. Processing such data in exponent
form is quite natural and efficient, as it lends a ‘linear’ simplicity to what is actually
logarithmic.
The code examples given below use each tables’ samples verbatim. Higher resolution could
be achieved by linearly interpolating between table samples, since the slope change is very
slight from sample to sample. The cost, though, would be larger code and lower execution
speed.
Log Table ($C000-$CFFF)
The log table contains data used to convert unsigned numbers into base-2 exponents.
The log table is comprised of 2,048 unsigned words which make up the base-2 fractional
exponents of numbers. To use this table, you must first determine the integer portion of the
exponent of the number you are converting. This is simply the leading bit position. For
$60000000 this would be 30 ($1E). This integer portion will always fit within 5 bits. Isolate
these 5 bits into the result so that they occupy bit positions 20..16. In our case of $60000000,
we would now have a partial result of $001E0000. Next, top-justify and isolate the first 11
bits below the leading bit into positions 11..1. This would be $0800 for our example. Add
$C000 for the log table base and you now have the actual word address of the fractional
Page 420 · Propeller Manual v1.0

Related parts for 122-32000