Greetings, and thanks for the feedback!

#include <stdio.h>

typedef union {
        float f;
        int i;
} U;

static void t(double d) {
        printf("%e\n",d);
}

int main() {
        U u;

        u.i=1;
        printf("%he\n",u.f);
        t((double)u.f);
        return 0;

}

./tt
Good:
1.401298e-45
1.401298e-45

Bad:
2.652495e-315
2.652495e-315

uname -a
Linux alf 2.6.17.11 #2 Wed Aug 30 10:01:12 CEST 2006 alpha GNU/Linux
cc -v
Using built-in specs.
Target: alpha-linux-gnu
Configured with: ../src/configure -v 
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr 
--enable-shared --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix --enable-nls 
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-mpfr --enable-checking=release alpha-linux-gnu
Thread model: posix
gcc version 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)

-mieee does not help.  In gdb, u.f is the right number, but gets
 corrupted on function call.

Take care,


Falk Hueffner <[EMAIL PROTECTED]> writes:

> Camm Maguire <[EMAIL PROTECTED]> writes:
> 
> > Casting the smallest denormalized shortfloat to a double in a function
> > argument is destroying the number in the callee.  Do you know of a
> > workaround? 
> 
> What kind of machine is this on? Might also be a kernel bug. Do you
> have a stand-alone testcase?
> 
> -- 
>       Falk
> 
> 
> 

-- 
Camm Maguire                                            [EMAIL PROTECTED]
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to