I think that was the original assertion:
both double and float are 4 bytes under TOS on ATMEGA (at least).

I'd hate to have to get out of my chair and look, but I seem to
remember that KnR do not specify the sizes of various types, it's all
up to the platform. int and long can be of the same or different size,
and, of course, pointers can vary according to the impl (16, 32, or 64
bits, usually). "Most often" the register size of the machine will
be the default pointer and int size as well...not to mention the
PDP10 (I think that was the machine) which had 10 bit bytes...
That's why the use of int8_t etal has become common.

"double" in FP refers to precision not word size, but they usually
go hand in hand.

MS


Sankar Gorthi wrote:
the double format is supported in T1 afaik.

how do i know? here's a message format I used when sending data to and from the Cricket motes:

typedef struct CricketCoordMessage {
    uint8_t id;
    char X[1];
    double CoordX;
    char Y[2];
    double CoordY;
}CricketCoordMessage;

worked just fine.

the #include <stdio.h> line was also there at the top of the header file, but I didn't put it there (came with the Cricket code).

and I used 4 bytes for double (i was working with the assumption that double refers to a double word which would be two two byte words hence 4 bytes long). it worked just fine there too.

back to K&R with me.

Sankar.

On Mon, 27 Nov 2006 14:50:02 -0600, Michael Schippling <[EMAIL PROTECTED]> wrote:

huh...as I said I don't use them...
and I'm not setup to verify your assertion right now.
Perhaps the math lib only supports floats.
MS

venkatesh s wrote:
I had questioned the same long back. As we know that float takes 4 bytes and double takes 8 bytes, experimentally on mica2 motes, it had no effect on the number of bytes. It was fixed to 4 bytes for both float and double.. Is it platform specific??
     Date: Sat, 25 Nov 2006 19:40:36 -0700
From: Michael Schippling < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
    Subject: Re: [Tinyos-help] working with floats and tinyos1
    To: Sankar Gorthi <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>
    Cc: [email protected]
    <mailto:[email protected]>
    Message-ID: <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>
    Content-Type: text/plain; charset=ISO-8859-15; format=flowed
     As long as you remain on the same platform with the same math lib
    floats and doubles should be transparent, as described. However
    sending them to a base-station could be problematic. I believe
    the MIG message generator for Java can deal with both FP types,
    but I try to avoid them so I'm not sure...a couple experiments
might be in order...under TOS floats should be 4 bytes and doubles 8,
    and I have some faith that they are standard IEEE format. So the
    only issue would be getting the byte ordering right.
     Or...as I keep reiterating, fixed-point integers can often do
    all the work at a much smaller cost.
     MS
------------------------------------------------------------------------
 _______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



--Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to