This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Floating point representation with Ecos
- From: Sergei Organov <osv at javad dot com>
- To: ecos-discuss at sources dot redhat dot com
- Cc: "Ramiro C. Carvalho" <ramiro dot carvalho at uol dot com dot br>
- Date: Wed, 01 Mar 2006 22:41:30 +0300
- Subject: [ECOS] Re: Floating point representation with Ecos
- References: <001d01c63c96$ca6e1210$326062c8@homeuser>
"Ramiro C. Carvalho" <ramiro.carvalho@uol.com.br> writes:
> Hi, everybody.
>
> I am experiencing problems exchanging floating point data between my Ecos
> target (ARM7 processor and gcc 4.0.1) and Matlab under Windows XP (which
> uses IEEE 754 standard).
ARM7 working in little-endian mode has big-endian order of 2 4-byte
words in double and little-endian order of bytes inside the words, while
ix86 has little-endian-everything. This doesn't depend on eCos or
Windows, -- it's entirely hardware incompatibility.
Fix your code running on ARM7 processor to output doubles in the
order that ix86 expect them. You need to swap 2 4-byte words of
double. Something like this:
void outDouble(double d)
{
union U {
double d;
unsigned u[2];
};
union U u;
u.d = d;
outUnsigned(u.u[1]);
outUnsigned(u.u[0]);
}
-- Sergei.
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss