Hi,
I am developing application using Cricket system, I
just found out that the pow() function is not working
when computing 2 to the power of 0. I made a dummy
task to show the problem:
//////Below is dummy task/////////////////////////
task void reportPow() {
static uint16_t un = 0; uint16_t ur;
static int in = 0; int ir;
static double dn= 0.0; double dr;
ur = pow(2,un);
printf("uint16: 2^%u = %u, ", un,ur);
ir = pow(2,in);
printf("int: 2^%d = %d, ", in,ir);
dr = pow(2,dn);
printf("double: 2.0^%g = %g\r\n", dn,dr);
un++;
in++;
dn++;
}
//////Above is dummy task/////////////////////////
This task will be posted each every second. The result
showing from HyperTerminal is:
////////Below is from hyperTerminal//////////////////
uint16: 2^0 = 0, int: 2^0 = 0, double: 2.0^0 = 0.5
uint16: 2^1 = 2, int: 2^1 = 2, double: 2.0^1 = 2
uint16: 2^2 = 4, int: 2^2 = 4, double: 2.0^2 = 4
uint16: 2^3 = 8, int: 2^3 = 8, double: 2.0^3 = 8
uint16: 2^4 = 16, int: 2^4 = 16, double: 2.0^4 = 16
uint16: 2^5 = 32, int: 2^5 = 32, double: 2.0^5 = 32
uint16: 2^6 = 64, int: 2^6 = 64, double: 2.0^6 = 64
uint16: 2^7 = 128, int: 2^7 = 128, double: 2.0^7 = 128
uint16: 2^8 = 256, int: 2^8 = 256, double: 2.0^8 = 256
uint16: 2^9 = 512, int: 2^9 = 512, double: 2.0^9 = 512
////////Above is from hyperTerminal//////////////////
So how is TinyOS handling the math function pow(), is
it the same from Cygwin? How could pow(2,0) return a
0, instead of 1.
Similar c program construction has been made, and
compiled by Cygwin gcc, the computation is correct in
Cygwin. So it seems that TinyOS is using different
math lib.
Anyone have any ideas of why?
Regards,
Feng Kai
___________________________________________________________
Yahoo! Photos NEW, now offering a quality print service from just 8p a photo
http://uk.photos.yahoo.com
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help