Break a leg ! :)

On Thu, Feb 18, 2010 at 10:06, Andreas Weigel
<[email protected]>wrote:

> Hi David, Miklos,
>
> thanks a lot for your help. Sorry for this late answer ---I broke my arm
> the day I put this message on the list and wasn"t to concerned with
> TinyOS then. I will try out what you proposed and will let you know the
> results as soon as I'm back to work (likely next Monday).
>
> Regards,
> Andreas
> > Hi David,
> >
> > On Tue, Feb 9, 2010 at 1:41 AM, David Gay <[email protected]> wrote:
> >
> >> On Mon, Feb 8, 2010 at 11:35 AM, Miklos Maroti <
> [email protected]> wrote:
> >>
> >>> Janos, Andreas and David,
> >>>
> >>> From scale.h the scale32(x,a,b) call calculates x*a/b with fixed point
> >>> arithmetic without overflow. The offset was added to help rounding,
> >>> but it was not implemented correctly. If you want to calculate x/b,
> >>> then it makes sense to calculate it as (x + b>>1)/b to get the
> >>> rounding effect. However, this is NOT needed here since a/b should be
> >>> close to 1 and in fact the added offset should be a/(2*b). So I think
> >>> this is clearly a bug and should be removed!
> >>>
> >>> Andras, can you please change the code to
> >>>
> >>>   async command uint32_t Atm128Calibrate.calibrateMicro(uint32_t n) {
> >>>     return scale32(n, cycles, MAGIC);
> >>>   }
> >>>
> >>>   async command uint32_t Atm128Calibrate.actualMicro(uint32_t n) {
> >>>     return scale32(n, MAGIC, cycles);
> >>>   }
> >>>
> >>> and rerun your experiments? David, can you confirm that this is indeed
> a bug?
> >>>
> >> Yes, your summary is correct (except that the ideal offset would be
> >> b/2a, which would be ~1/2).
> >> It might be worth forcing the result to be at least 1 as well - do we
> >> want calibrateMicro(1)/actualMicro(1) to sometimes give 0?
> >>
> >
> > Yes, you are right. Attached is a code that calculates ROUND(x*a/b),
> > and I think we should use this instead of FLOOR(x*a/b). We should
> > change this after the next release.
> >
> > I do not think we should care if something becomes 0, since the Alarms
> > take care of that, or people can check it manually, especially then
> > the input must be close to 0 too.
> >
> > Andreas, did you manage to run some tests?
> >
> > Miklos
> >
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Best Regards,
Arik Sapojnik
[email protected]
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to