Hi Mindaugas,

Actually, there is. But you'll have to use floating point numbers.

Brandon, I had a quick look at some documentation and did a few 
experiments. I think an enum would not help you here as it is for 
integer numbers and if you really want to use infinity (and NaN and the 
like) you would need floating point numbers. Floating point numbers are 
not the strong point of NesC, but you can basically use them as in C and 
hope that everything goes fine (as long as you only use one platform). I 
even managed to get floating point numbers into Java!

So floating point numbers have support for infinity: 
http://www.gnu.org/software/libtool/manual/libc/Infinity-and-NaN.html

However, the methods described in the link above are in the library, 
which, I think, are not available for TinyOS (at least the compiler 
complained). A potential solution (I haven't tried it) is described in 
this thread:
http://www.gamedev.net/community/forums/topic.asp?topic_id=363356

Basically, their idea is to force a certain binary value into the memory 
space of a float that is known to be a value of infinity (as defined in 
the floating point specification). This might work on the MSP430 as 
well, but to be sure one would need to test this to see whether it 
produces the correct behavior.

Cheers,
Urs


Mindaugas Jaraminas wrote:
> Hi Brandon
> 
> There is no such thing as infinity i n computer since. You can set
> variable to is maximum available value. For example:
> 
> UINT8 max val is 255 (dec) or 0xFF (hex)
> UINT18 max val is 0xFFFF and so on.

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

Reply via email to