From: helbig@man.ac.uk (Phillip Helbig)
Subject: Re: Why does this code dont work on Alpha?
Date: 2000/01/05 [thread overview]
Message-ID: <84vf60$r50$1@info.service.rug.nl> (raw)
In-Reply-To: 84vbos$v43$1@inet-1.pnu.com
In article <84vbos$v43$1@inet-1.pnu.com>, Pete <pete@no-spam.net>
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.
next prev parent reply other threads:[~2000-01-05 5:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-05 5:00 Why does this code dont work on Alpha? Pete
2000-01-05 5:00 ` Phillip Helbig [this message]
2000-01-05 5:00 ` Joe Mario
2000-01-05 5:00 ` Andreas Krall
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