Hello!
I am using telosb motes and tinyos-2.1.0. I have an application in which
some floating point operations are done and I wish to print (using
PrintfClient) only the decimal part of the result. Since the printed value
is not what it should be -it is always 65535- I wrote a simple program where
I have:
float y;
uint16_t x;
y=4354.542134509;
x=y;
printf("int(4354.542134509)=%u\n",x);
printfflush();
I run
java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSB0:telosb
and I get the 4354!
If I change the value stored in y to:
y=3354000112.542134509
then the printf returns 65535 -the same value as in my application! So I
guess this is because the value does not "fit" into a uint16_t. I change x
definition to uint32_t and %u to %ld (make is okay with that), but then the
printed value is -940967168!
What is the problem?
Thanks in advance,
Georgia
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help