From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <8c1dfc26beee1c555832c2fe78b5dd57.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199710061313.IAA32400@red.hex.net> Date: Mon, 06 Oct 1997 10:49:36 -0400 From: Uncle George Subject: axp/gcc the double cast gets trashed on return --------------719205A674A3765CD026A878 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi,tell me why the double value returned from go_convert() is not 7.0??? If u step through ( via gdb ) the val l.dd = 7, x.dd = 7, BUT d.dd is some bogus number. d.dd should have 7.0 Am I doing something wrong ( u cannot change the code, unless there is a "C" violation somewhere!!!!) GAT PS, thanks for the SIGNAL/FPE syscall. u should note ( although I havent verified ) that a sigfpe is still possible on a double conversion to long. ********************************************************* typedef long int64_t; double go_convert ( int64_t ); main() { union { long ll; double dd; } l, d; l.ll = 0x401c000000000000; d.dd = go_convert ( l.ll ); } double go_convert( int64_t v ) { union { long ll; double dd ; } x; x.ll = v; return(x.dd); } > -- > To unsubscribe: send e-mail to axp-list-request@redhat.com with > 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com --------------719205A674A3765CD026A878 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi,tell me why the double value returned from go_convert() is not 7.0??? If u step through ( via gdb ) the val l.dd = 7, x.dd = 7,     BUT d.dd is some bogus number. d.dd should have 7.0 Am I doing something wrong ( u cannot change the code, unless there is a "C" violation somewhere!!!!) GAT PS, thanks for the SIGNAL/FPE syscall. u should note ( although I havent verified ) that a sigfpe is still possible on a double conversion to long. ********************************************************* typedef long    int64_t; double go_convert ( int64_t ); main() {         union {                 long    ll;                 double  dd;         } l, d;         l.ll = 0x401c000000000000;         d.dd = go_convert ( l.ll ); } double go_convert( int64_t v ) { union   {         long ll;         double dd ; } x;         x.ll = v;         return(x.dd); } -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com   --------------719205A674A3765CD026A878-- -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com