[Tinyos-devel] Re: external (nx*) types and floating point
David Gay
dgay42 at gmail.com
Wed Oct 10 08:21:41 PDT 2007
A note: when answering a digest, please enter a correct subject.
People are likely to ignore posts with titles like "Re: Tinyos-devel
Digest, Vol 54, Issue 11"...
On 10/10/07, Hristo Bojkov <hbojkov at idxs.eu> wrote:
> >Date: Tue, 9 Oct 2007 09:07:50 -0700
> >From: "David Gay" <dgay42 at gmail.com>
> >Subject: [Tinyos-devel] external (nx*) types and floating point
> >To: "TinyOS Development" <tinyos-devel at millennium.berkeley.edu>
> >Message-ID:
> > <f331126a0710090907s75748d7at376ea4abf09cddb7 at mail.gmail.com>
> >Content-Type: text/plain; charset=ISO-8859-1
> >
> >There's currently no nx_float / nx_double type that would allow use of
> >floating point in protocols.
> >
> >Two questions:
> >- how necessary are such types? (w/o them, you have to figure out some
> >integer encoding for any real numbers you have to deal with)
> >
> >- does anybody have some portable code (and not too large...) for
> >converting an array of bytes to a float/double? (that's the main
> >sticking point as far as I'm concerned)
> >
> >Some additional comments:
> >- specifying these types as IEEE 32 and 64-bit numbers seems reasonable
> >
> >- I'm reluctant to include platform-specific code w/ the nesC
> >distribution to deal with nx_float/nx_double, as it feels like it
> >would make nesC maintenance more painful
> >
> >- we could actually define nx_float/nx_double in TinyOS (on a
> >per-chip or per-platform basis, e.g.) - external types are defined by
> >a magic (undocumented) attribute, so can fairly easily be added
> >independent of nesC
> >
> >David Gay
>
> By speaking about " IEEE 32 and 64-bit numbers " do you mean IEEE 754?
> If so? I have some funcs about single precision. They can be included in
> float module, if you like them.
Yes. The functions below have the major problem I alluded to in my 2nd
question: they are not portable, as different platforms may lay out
the bytes forming their floating-point numbers differently.
> I just have a question ... What about small float with 16bit precision which
> is presented in IEEE 754r?
It wouldn't be very useful w/o C compiler support for a native 16-bit
floating-point type. When/if C compilers have such support, a
corresponding nx type will be a good idea.
David Gay
More information about the Tinyos-devel
mailing list