Article View: gnu.gcc.help
Article #54317GCC Bug or Feature?
From: Perry Lee Statham
Date: Wed, 12 Dec 1990 18:55
Date: Wed, 12 Dec 1990 18:55
28 lines
1237 bytes
1237 bytes
/*
Can anyone tell me why the following program returns a floating point
exception under GCC? It works fine when compiled under the SCO Xenix
compiler.
My compile command is:
gcc -w -g -traditional -funsigned-char -o testprog testprog.c
and I am using gcc 1.37.1d
I also noticed that if I change the return line to:
return (double) (((int) date[6]-'0')*10 + ((int) date[6+1]-'0'));
then it will work fine, but I do not know why.
Thanks
Perry Lee Statham
statham@cup.portal.com
*/
double dom(char *date)
{
return (double) ((date[6]-'0')*10 + (date[6+1]-'0'));
}
main()
{
printf("DAY OF MONTH = %g\n",dom("19901122"));
}
Technical Details
Message-ID:
<36841@cup.portal.com>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!cup.portal.com!stathamShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,fd06dd02f59d1cd3,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1990-12-12 10:55:17 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!cup.portal.com!statham From: statham@cup.portal.com (Perry Lee Statham) Newsgroups: gnu.gcc.help Subject: GCC Bug or Feature? Message-ID: <36841@cup.portal.com> Date: 12 Dec 90 18:55:17 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: The Portal System (TM) Lines: 28 Posted: Wed Dec 12 19:55:17 1990