Hi,
I'am a PhD student and I'm trying to write a program that calculate the
sin() function.
I use tinyos 1.1.15 under ubuntu
In the makefile of application I have insert
PFLAGS+=-I/usr/include
because I have found that the math.h file is located in /usr/include, and my
simple code is:
includes math;
.....
for (t=0;t<60;t=t+(1/fc)){
x=2*M_PI*t*50;
y[indice]= sin(x);
dbg(DBG_TEMP," sin(%e) = %e\n",x,y[indice]);
indice++;
}
....
I compiled it with success, but when I run it, the output I obtain isn't
correct. For example:
SIM: EEPROM system initialized.
SIM: event queue initialized.
SIM: Random seed is 123198
SIM: Initializing sockets
SIM: Created server socket listening on port 10584.
SIM: Created server socket listening on port 10585.
SIM: Time for mote 0 initialized to 30244808.
0: BOOT: Scheduling for boot at 0:0:7.56120200.
0: Popping event for mote 0 with time 0:0:7.56120200.
0: Setting TOS_LOCAL_ADDRESS to 0
0: BOOT: Mote booting at time 0:0:7.56120200.
0: sin(0.000000e+00) = 0.000000e+00
0: sin(3.141593e+02) = 1.964791e-15
0: sin(6.283185e+02) = 3.929582e-15
0: sin(9.424778e+02) = -5.094905e-14
0: sin(1.256637e+03) = 7.859165e-15
0: sin(1.570796e+03) = -1.607063e-13
0: sin(1.884956e+03) = -1.018981e-13
0: sin(2.199115e+03) = -2.704636e-13
0: sin(2.513274e+03) = 1.571833e-14
Why sin() function dosn't run well??And the same problem happen when I use
the abs() function!
I think the problem is in the math.h file I use, but I don't understand
where
can anyone help me??! Any suggest is very appreciated, really!!
Ps: sorry for my english!
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help