Thomas Klausner wrote: > > - In gdb of this test, compiled with CFLAGS=-g (no optimization): > > print mantissa > > print i > > print x > > print *(void*(*)[4])&mantissa > > print *(void*(*)[4])&x > > (gdb) print mantissa > $1 = 0.505 > (gdb) print i > $2 = 1 > (gdb) print x > $3 = 1.01 > (gdb) print *(void*(*)[4])&mantissa > $4 = {0x8147ae147ae14800, 0x7f7ffdb13ffe, 0x0, 0x7f7ffdb10040} > (gdb) print *(void*(*)[4])&x > $5 = {0x8147ae147ae147ae, 0x3fff, 0xc000000000000000, 0xffff}
This means that the first loop iteration already introduced rounding errors. > #if defined __x86_64__ && defined __GNUC__ > makes the failure go away. Bingo! I'm applying this: 2008-04-12 Bruno Haible <[EMAIL PROTECTED]> * lib/fpucw.h: Enable the definitions also for x86_64. Needed for NetBSD/x86_64. Reported by Thomas Klausner <[EMAIL PROTECTED]>. --- lib/fpucw.h.orig 2008-04-13 02:25:39.000000000 +0200 +++ lib/fpucw.h 2008-04-13 02:22:38.000000000 +0200 @@ -1,5 +1,5 @@ /* Manipulating the FPU control word. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. Written by Bruno Haible <[EMAIL PROTECTED]>, 2007. This program is free software: you can redistribute it and/or modify @@ -61,7 +61,7 @@ */ /* Inline assembler like this works only with GNU C. */ -#if defined __i386__ && defined __GNUC__ +#if (defined __i386__ || defined __x86_64__) && defined __GNUC__ typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */