Bug In Arithmetic OpsI did more tests, and the problem still persists.
It seems that the evaluation becames incorrect when the T1 operand is bigger
then 2^24.

Below the operands T1, T2.
T1 is the LocalTime.get() value. AlwaysT1 >= T2.

The subtraction T1-T2  evaluated by mote, T1-T2 by Calc OpenOffice,
then (T1-T2 by mote)-(T1-T2 by Calc) and last one logT1 in base 2. The same
data in the attachment.

I'll send the code if you need, but I'm sure that there aren't errors in it.

I hope to find a solution.
thanks

    T1               T2       T1-T2 by mote   T1-T2 by Calc   Difference
logT1/log2
     855939          0          855939        855939                   0
       19,71
    1080074          0         1080074       1080074               0
   20,04
    1304094          0         1304094       1304094                0
      20,31
    1527878          0         1527878       1527878              0
  20,54
    1752031          0         1752031       1752031               0
    20,74
    1976069    1752031          224038        224038              0
20,91
    2200158    1752031          448127        448127               0
21,07
    2423937    1752031          671906        671906               0
21,21
    2647958    1752031          895927        895927               0
21,34
    2872112    1752031         1120081       1120081             0
21,45
    3095955    2872112          223843        223843               0
21,56
    3320035    2872112          447923        447923               0
21,66
    3544056    2872112          671944        671944               0
21,76
    3991897    2872112         1119785       1119785               0
21,93
    4216082    2872112         1343970       1343970               0
22,01
    4440013    4216082          223931        223931               0
22,08
    4664020    4216082          447938        447938               0
22,15
    4887890    4216082          671808        671808               0
22,22
    5112021    4216082          895939        895939               0
22,29
................... so on
   14968035   14519830          448205        448205               0
23,84
   15192078   14519830          672248        672248               0
23,86
   15415996   14519830          896166        896166               0
23,88
   15639997   14519830         1120167       1120167               0
23,9
   15864070   15639997          224073        224073               0
23,92
   16088088   15639997          448091        448091               0
23,94
   16311940   15639997          671943        671943               0
23,96
   16535801   15639997          895804        895804               0
23,98
   16759804   15639997         1119807       1119807               0
24
   16983908   16759804          224103        224104              -1
24,02
   17207968   16759804          448163        448164              -1
24,04
   17431826   16759804          672022        672022               0
24,06
   17655872   16759804          896068        896068               0
24,07
   17879856   16759804         1120051       1120052              -1
24,09
   18104068   17879856          224214        224212               2
24,11
   18327976   17879856          448121        448120               1
24,13
   18551916   17879856          672061        672060               1
24,15
   18775816   17879856          895962        895960               2
24,16
   18999976   17879856         1120121       1120120               1
24,18
   19224148   18999976          224172        224172               0
24,2
   19447848   18999976          447872        447872               0
24,21
   19671998   18999976          672022        672022               0
24,23
   19895796   18999976          895820        895820               0
24,25
   20119868   18999976         1119891       1119892              -1
24,26
   20343896   20119868          224029        224028               1
24,28
............

2007/11/21, Philip Levis <[EMAIL PROTECTED]>:
>
>
> On Nov 21, 2007, at 1:21 PM, Federico Fiorentin wrote:
>
> >
> > > Are you sure that you have no warning like "non-atomic read or
> > write"?
> > I'm sure, there is right use of atomic statement.
> >
> > David, you said that it normal this behavior.
> > isn't there any solution for this problem?
> >
> > You said that msp430-gcc's use of the multiply instruction is
> > broken :-(
> > Does this affect normal subtraction too?
> >
> > I'm very surprised that MSP430 has problem in normal arithmetic
> > operation like add,sub...
>
> I'd be very surprised as well. If there's a problem, it's the
> compiler. That being said, after years of thousands of users, this is
> the first it's ever come up. So it might just be your code. Take a
> look at the assembly -- does it look right?
>
> Phil
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to