1. floats are 4 bytes, doubles usually default to floats as well 2. our microcontrollers only have an integer multiply instruction 3. therefore floating point arithmetic is expensive 4. there's nothing you can measure beyond 10-12 bit accuracy 5. therefore fixed point is a better use of resources
MS Nouha Baccour wrote: > Hi all, > > I am programming with Tinyos/TOSSIM 2. Particularly I am working on > CTP data collection protocol. > > Meanwhile, I needed to define float (or double) variables. I found > many problems like "floating point exception", other issues related to > casting... > Finally I was able to integrate my float variables. However, I don’t > know what are the consequences of defining these float variables. > In fact, I remarked that tinyos community avoids using floats or > double. For example, for the PRR (packet reception ratio) that can be > found in LinkEstimationP.nc, the authors, multiply PRR by 100 in order > to have integer (uint8_t) PRR, between 0 and 100, instead of float > PRR, between 0 and 1!!! > This is just an example but there are more. > > So I would like to know what is the problem by using real variables. > > Can anyone feedback on that? > > Thanks in advance > > Nouha > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
