At 09:34 AM 10/15/2005 -0700, you wrote: > > How would you calculate e^(-at) in 32 bit integer math? > > > > Why does it need to be integer math? From your previous post > > I got the impression this calculation was going to be done at > > assembly time. > >The assembler I'm using only supports integer math. No fractions. No >floating point. Just integers. So if you put in .36 it becomes 0. 92/256 = >0. Integer math. Okay so you imagine a radix point at an appropriate place. You can move it around after each intermediate calculation with shifts, provided you don't overflow. Unfortunately, you've got to deal with "C-like" integer math and don't have access to the full 64-bits of a multiply, only the least significant 32 bits. For example, 0.36 might be represented as 0x0002E14 (0.36 * 32768). The radix point is between the MS 2 bytes and the LS 2 bytes. >How do you calculate e^(-x) where x is between 1/256 and 192/256 using only >integer math. A Taylor series might do it acceptably well. >Best regards, Spehro Pefhany --"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com ->> Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist