ts-7000
[Top] [All Lists]

Re: [ts-7000] floating point corruption?

To:
Subject: Re: [ts-7000] floating point corruption?
From: "Martin Guy" <>
Date: Wed, 27 Feb 2008 19:02:16 +0000
2008/2/27, Daniel Serpell <>:
> Hi,
>
>
>  On Wed, Feb 27, 2008 at 10:19 AM, Heinrich du Toit
>  <> wrote:
>  >  When I send from the ARM to the host PC the number 1.
>  >  I get back 5.29981e-315  :-/
> This seems an endianness problem, because if you swap the
>  words in a double with the number "1", you get exactly your number:
>   union {
>    double d;
>    int i[2];
>   } a,b;
>
>   a.d = 1;
>
>   b.i[0] = a.i[1];
>   b.i[1] = a.i[0];
>   printf("Original: [%08x%08x] %g\n",a.i[0],a.i[1],a.d);
>   printf("Swapped:  [%08x%08x] %g\n",b.i[0],b.i[1],b.d);

The old-ABI floating point words are in the ARM FPA format, which is
IEEE754 little-endian format but the two 32-bit words of a 64-bit
double are in big-endian order 45670123 Curse those big-endian
infiltrators! :)
EABI instead reverts to pure little-endian, exactly as used on 386 and
most other little-endian hosts, so I guess that means your ARM
programs are compiled using old-ABI and FPA format. If you are using
an EABI cross-compiler it should be using pure little-endian - try the
test commands mentioned at the start of wiki.debian.org/ArmEabiPort on
your binaries to find out. In any case, updating your tools would not
be a bad thing.

Unless you're strapped for bandwidth, another option would be to send
them as printf/sscanf strings.

    M


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU