| ??? 12/20/01 16:57 Read: times |
#17900 - RE: how to use an array using asm |
Rao,
Do a search for FIXED POINT MATH. Here is a summary of what you need to do... For your example of "4.25", move the decimal place over 2 digits and represent the number as "425". When displaying the number, just poke in the decimal point before the last two digits. Essentially, you multiply the value by the precission that you want. This allows you to store the value as an integer with an assumed 'factor'. You can do math with the value assuming you follow some simple rules... Addition and Subtraction requires all values to have the same assumed factor. And, the result will have the same factor as the original values. For Multiplication and Division the values can have any factors and don't have to be the same. The result value will have an assumed factor being the result of the same operation done to the two factors. Fixed point math is somewhat like using floating point math, but the programmer is required to keep track of the exponent portion of the result. Here are some examples of doing fixed point math where the (f) falue is the assumed 'factor' which is held in your head when doing the operations. Adding... A = 4.25 + 1.5 A = 425(f100) + 150(f100) A = 675(f100) A = 6.75 Multiplying... X = 4.25 * 1.5 X = 425(f100) * 15(f10) X = 425*15 (f100)*(f10) X = 6375 (f1000) X = 6.375 Dividing... Y = 4.05 / 1.5 Y = 405(f100) / 15(f10) Y = 405/15 (f100)/(f10) Y = 17 (f10) Y = 1.7 <>< Lance |
| Topic | Author | Date |
| how to use an array using asm | 01/01/70 00:00 | |
| RE: how to use an array using asm | 01/01/70 00:00 | |
| RE: how to use an array using asm | 01/01/70 00:00 | |
| RE: how to use an array using asm | 01/01/70 00:00 | |
| RE: how to use an array using asm: Lance | 01/01/70 00:00 | |
| RE: how to use an array using asm: Steve | 01/01/70 00:00 | |
| RE: how to use an array using asm: Steve | 01/01/70 00:00 | |
| RE: how to use an array using asm: Erik | 01/01/70 00:00 | |
| RE: how to use an array using asm: Steve | 01/01/70 00:00 | |
RE: how to use an array using asm: Erik | 01/01/70 00:00 |



