On Thu, 2005-08-18 at 09:40 -0700, Robert Simpson wrote:
> http://www.psc.edu/general/software/packages/ieee/ieee.html
> 
> The way I interpreted this site, is that the IEEE standard for floating 
> point numbers was processor agnostic and the storage of the bits went from 
> left to right.
> 

I wrote a test program to print out the byte values for 1.0 and 1
on both ix86 (Intel, Linux) and powerpc (G5, OS-X).  The results:

    ix86:   000000000000f03f  0100000000000000
 powerpc:   3ff0000000000000  0000000000000001

This seems to validate the approach taken by SQLite, which is to
byteswap floating point values on ix86 machines.

My test code is below.  Please run this on your ARM and let me
know what you get.

union utest {
  double r;
  long long i;
  unsigned char z[8];
};

int main(int argc, char **argv){
  union utest x;
  x.r = 1.0;
  printf("%02x%02x%02x%02x%02x%02x%02x%02x\n",
    x.z[0], x.z[1], x.z[2], x.z[3], x.z[4], x.z[5], x.z[6], x.z[7]);
  x.i = 1;
  printf("%02x%02x%02x%02x%02x%02x%02x%02x\n",
    x.z[0], x.z[1], x.z[2], x.z[3], x.z[4], x.z[5], x.z[6], x.z[7]);
  return 0;
}

-- 
D. Richard Hipp <[EMAIL PROTECTED]>

Reply via email to