From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,7744da37a4fb6b38 X-Google-Attributes: gid1164f8,public From: helbig@man.ac.uk (Phillip Helbig) Subject: Re: Why does this code dont work on Alpha? Date: 2000/01/05 Message-ID: <84vf60$r50$1@info.service.rug.nl>#1/1 X-Deja-AN: 568617286 References: <84vbos$v43$1@inet-1.pnu.com> X-Complaints-To: newsmaster@rug.nl X-Trace: info.service.rug.nl 947077120 27808 129.125.6.17 (5 Jan 2000 12:58:40 GMT) Organization: University of Manchester, Jodrell Bank Observatory Reply-To: p.helbig@jb.man.ac.uk NNTP-Posting-Date: 5 Jan 2000 12:58:40 GMT Newsgroups: comp.sys.dec In article <84vbos$v43$1@inet-1.pnu.com>, Pete writes: > I wonder why I get > Floating point exception (core dumped) > then I run this very simple C code? > > main() > { > float x = 3.14; > long i; > for (i=0;i<1000000000;i++) > x=x*x; > } > > It runs fine on both Solaris and Linux. ^^^^^^^^^ You need to think about what that really means. Here's the traceback from a VMS system (21064A, DEC C V6.0-001 on OpenVMS Alpha V7.2-1, but these facts are not crucial here). %SYSTEM-F-HPARITH, high performance arithmetic trap, Imask=00000000, Fmask=00000 001, summary=08, PC=00000000000200C4, PS=0000001B -SYSTEM-F-FLTOVF, arithmetic trap, floating overflow at PC=00000000000200C4, PS= 0000001B %TRACE-F-TRACEBACK, symbolic stack dump follows image module routine line rel PC abs PC TEST TEST main 6 00000000000000C4 00000000000200C4 TEST TEST __main 0 0000000000000068 0000000000020068 0 FFFFFFFF82A913D4 FFFFFFFF82A913D4 It's pretty obvious that you're getting overflow. (I REALLY like the fact that /DEBUG=(TRACEBACK,NOSYMBOLS) is the default on VMS.) Yes, some other systems don't notice the overflow, `run fine' and produce garbage. I would rather have a program crash than run wrongly.