Christian Heimes added the comment:
I've written a small C program for auto config that checks the
endianness of IEEE doubles. Neil has promised to add something to
configure.in when I come up with a small C program. It *should* do the
right thing on a BE platform but I can't test it.
Tim, does Python run on a non IEEE 754 platform? Should the new repr()
be ripped out? I hate to break Python for scientists just to silence
some ignorants and unexperienced newbies.
----------
nosy: +nascheme
Added file: http://bugs.python.org/file8920/ieee_dbl.c
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1580>
__________________________________
#define BIAS 1023
typedef struct {
unsigned int sign : 1;
unsigned int exp : 11;
unsigned int m1 : 4;
unsigned int m2 : 16;
unsigned int m3 : 16;
unsigned int m4 : 16;
} be_ieee_dbl;
typedef struct {
unsigned int m4 : 16;
unsigned int m3 : 16;
unsigned int m2 : 16;
unsigned int m1 : 4;
unsigned int exp : 11;
unsigned int sign : 1;
} le_ieee_dbl;
/* 1 = little endian IEEE double
* 2 = big endian IEEE double
* 0 = error
*/
int main(void)
{
double dbl = -9.;
le_ieee_dbl *le = (le_ieee_dbl*)&dbl;
be_ieee_dbl *be = (be_ieee_dbl*)&dbl;
if (le->sign == 1 && le->exp-BIAS == 3 && le->m1 == 2 &&
le->m2 == 0 && le->m3 == 0 && le->m4 == 0) {
return 1;
}
if (be->sign == 1 && be->exp-BIAS == 3 && be->m1 == 2 &&
be->m2 == 0 && be->m3 == 0 && be->m4 == 0) {
return 2;
}
return 0;
}
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com