A89: Re: Floating-point "imitation"


[Prev][Next][Index][Thread]

A89: Re: Floating-point "imitation"




>>   mulu.w #39322,d0
>>   swap   d0
>>
>>The net effect is a multiply by 0.6000061, which is 0.001% off from 0.6.
>
>How exactly does this work?  I see that 65535*.6 = 39321 (not 39322?) - can
>I do this with any fractial value?  Say

Doh!  I don't know WHY I didn't see before that you're doing the exact same
thing I did:

3    60     77    39322
- = --- ~= --- ~= -----
5   100    128    65535


>>   mulu.w #39322,d0
>
>I don't quite understand this either - if the value I want is in the upper
>word, then the fractional portion would be in the lower word - so wouldn't
>half a word ~= .5?  Wouldn't I add 32768?

Aha - you mean $8000, right?

32768 = $8000 = %1000000000000000

And this would round properly =)

Thanks again, Zoltan - where did you learn all this stuff, anyway?

    -Scott



Follow-Ups: