From: Uncle George <gatgul@voicenet.com>
Subject: axp/gcc the double cast gets trashed on return
Date: Mon, 06 Oct 1997 10:49:36 -0400 [thread overview]
Message-ID: <8c1dfc26beee1c555832c2fe78b5dd57.axp-list@archive.invalid> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2531 bytes --]
--------------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
next reply other threads:[~1997-10-06 14:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-06 14:49 Uncle George [this message]
[not found] <3438FA7E.E8FD1D28@voicenet.com>
1997-10-06 17:03 ` axp/gcc the double cast gets trashed on return Richard Henderson
1997-10-07 0:08 ` Volker Barthelmann
-- strict thread matches above, loose matches on Subject: below --
1997-10-06 18:35 Uncle George
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox