Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: DSP frac arithmetic help
Posted by: dml Feb,27.2015-15:28 

Hi,

Yes the multiplier is fractional, and assumes your sources are denormalized by 1 bit, which gets accounted for during multiplying. That's why you end up with 2x the expected result when multiplying integers.

So:

$400000 = 0.5
$200000 = 0.25
$7fffff = 0.99999

However you'll notice that it's not possible to represent the value 1.0 exactly.

There is a workaround in many situations, which is to work with *signed* sources, since it is possible to represent -1.0. Where necessary, use the special signing version of the multiplier to work with tables of -ve numbers.

e.g.

mpy -x0,y0,a

where:
x0 == -1.0 == $800000


Just be prepared to get slightly confused again when you try to square a fraction :)

Hope that helps.










[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
DSP frac arithmetic help Laurent / Thadoss Feb,27.2015-15:03
  Re: DSP frac arithmetic help Laurent / Thadoss Feb,27.2015-15:08
  Re: DSP frac arithmetic help dml Feb,27.2015-15:28
    Re: DSP frac arithmetic help Laurent / Thadoss Feb,27.2015-18:32
      Re: DSP frac arithmetic help dml Feb,27.2015-18:42
        Re: DSP frac arithmetic help dml Feb,27.2015-18:46
          Re: DSP frac arithmetic help Splash/S1 Feb,27.2015-20:21
            Re: DSP frac arithmetic help dml Feb,27.2015-20:38
              Re: DSP frac arithmetic help Laurent / Thadoss Feb,27.2015-20:42
    Re: DSP frac arithmetic help mikro Feb,28.2015-10:44
      Re: DSP frac arithmetic help dml Feb,28.2015-12:35


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson