home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.ultrix
- Path: sparky!uunet!gumby!wupost!cs.uiuc.edu!vela!amaranth
- From: amaranth@vela.acs.oakland.edu (Paul Amaranth)
- Subject: Re: FPU errors on 5000/240 P.Amaranth
- Message-ID: <1992Nov17.195628.15041@vela.acs.oakland.edu>
- Organization: Oakland University, Rochester MI.
- References: <1992Nov10.161523.20950@hubcap.clemson.edu> <1992Nov11.185218.15068@vela.acs.oakland.edu> <1eb0jpINNok9@nestroy.wu-wien.ac.at>
- Date: Tue, 17 Nov 1992 19:56:28 GMT
- Lines: 82
-
- [much verbage deleted...]
-
- In article <1eb0jpINNok9@nestroy.wu-wien.ac.at> hauser@wu-wien.ac.at writes:
- >An impressive exercise you will never forget is:
- >
- > program noforget
- > double precision a
- > a=1.0d0
- > call printa(a)
- > stop
- > end
- > program noforget
- > double precision a
- > a=1.0d0
- > call printa(a)
- > stop
- > end
- >c
- > subroutine printa(a)
- > double precision a
- > print *, a
- > end
- >ccc
- >now change the main program to
- >
- > program noforget
- > call printa(1.0)
- > stop
- > end
- >c
- >If you use 1.0d0 everything is o.k., but not with 1.0 !
- >
- >--
- >Michael Hauser
-
- Not to flame on this, but you should at least know Fortran before
- critisizing. Of course you will get different answers on printa when
- you call it with different data type arguments. Fortran arguments
- are sent by reference, so the subroutine thinks it has a double
- precision argument, even when a single precision is sent. God knows
- what's in the second word. For that matter, you could send a character
- argument to printa and it would merrily interpret it as a double precision
- number.
-
- Mixed mode arithmetic is defined in Fortran, so the integers in my
- little program example will be converted to a double precision value
- for the calculations by the compiler. Now most people would argue that
- it's good form to use double precision constants and explicitly convert
- integers to double precision using a dfloat function, and I wouldn't argue,
- but it's not necessary. Here's a quote from a DEC fortran manual:
-
- ... Any integer elements [in a real calculation] are converted to the real
- data type ...
-
- and
-
- ... Any element in an operation in which there is a higher-precision
- element is converted to the data type of the higher-precision element
- by making the existing element the most significant portion of the
- higher-precision data. The least significant protion of the binary
- representation is zero.
-
-
- Sheesh.
-
- BTW: these same types of calculations are the reason the Smith FPU
- test program fails. I just got rid of the noise.
-
- And if you read the original post, you would have seen that it works
- fine and consistently on either non 5000/240 hardware or fixed 5000/240
- hardware. You only get wierd results on a non-fixed 5000/240 (some
- processors only). This is using the SAME object, only different
- platforms (so it's not a compiler problem).
-
- Double sheesh.
-
- I don't have time for this.
- --
- Paul Amaranth Manager User Services - office: (313) 370 4541 (also voicemail)
- (internet) amaranth@vela.acs.oakland.edu | This space
- (bitnet) amaranth@oakland | temporarily
- (uucp) ...!uunet!umich!vela!amaranth | empty
-