By: I.Kövesdi ,
created: 2013-04-05
| updated: 2013-04-05

The PST application shows the first Fixed-point arithmetic library object on OBEX. The "SPIN_TrigPack" object is a complete Fixed-point package with the basic trigonometric functions for robot and navigation projects. You can do ATAN2 without enlisting extra COGs to run a full Floating-point library for that function. This small object has string conversion utilities to make Fixed-point math easy in your SPIN language based applications.

The object contains the first True Random Generator with the Propeller microcontroller written in SPIN code only. This TRNG will repeat its sequence only after the end of Times. Nobody knows why does it work. Maybe, you will be the first to find out.

## Comments

Jeff Ledger replied on Permalink

[originally posted by Anonymous on 2011-09-23 16:28:57] Found a bug in the sin calc. At exactly 90 and 270 degrees. I changed the fundamental sin calc as follows: CASE (iA & %1_1000_0000_0000) %0_0000_0000_0000: '1st quadrant [0, 90] RETURN WORD[_BASE_SINTABLE][iA & $7FF] %0_1000_0000_0000: '2nd quadrant [90, 180] if (iA & $7FF) RETURN WORD[_BASE_SINTABLE][-iA & $7FF] else RETURN WORD[_BASE_SINTABLE][$7FF] %1_0000_0000_0000: '3rd quadrant [180, 270] RETURN -WORD[_BASE_SINTABLE][iA & $7FF] %1_1000_0000_0000: '4th quadrant [270, 380] if (iA & $7FF) RETURN -WORD[_BASE_SINTABLE][-iA & $7FF] else RETURN -WORD[_BASE_SINTABLE][$7FF]