home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.compilers
- Path: sparky!uunet!think.com!spdcc!iecc!compilers-sender
- From: jlg@cochiti.lanl.gov (J. Giles)
- Subject: Re: IEEE arithmetic handling
- Reply-To: jlg@cochiti.lanl.gov (J. Giles)
- Organization: Los Alamos National Laboratory
- Date: Tue, 17 Nov 1992 19:42:06 GMT
- Approved: compilers@iecc.cambridge.ma.us
- Message-ID: <92-11-095@comp.compilers>
- References: <92-11-041@comp.compilers> <92-11-087@comp.compilers>
- Keywords: arithmetic
- Sender: compilers-sender@iecc.cambridge.ma.us
- Lines: 52
-
- jlg@cochiti.lanl.gov (J. Giles) writes:
- > Unfortunately, the Fortran standard does not conform to
- > IEEE (in fact, it conflicts with it in some places - like with regard
- > to negative zero). And the Fortran standard does not require the same
- > conversion accuracy as the IEEE floating point standard.
-
- bill@amber.csd.harris.com (Bill Leonard) writes:
- |> I have a couple of nits to pick with this. First, Fortran does not
- |> *conflict* with the IEEE vis-a-vis negative zero. It merely says that the
- |> processor must never *output* a negatively-signed zero. That doesn't mean
- |> that variables in the program cannot contain such a value.
-
- Doesn't IEEE say that some form of output must be available for which
- output followed by input returns the same value? If the external
- representation is not even *allowed* to have the minus sign, how do you
- preserve it?
-
- |> [...]
- |> Were Fortran to require IEEE accuracy, then you would only see Fortran
- |> implemented on IEEE machines (or machines that exceeded the IEEE
- |> requirements). That would make a lot of Fortran users unhappy.
-
- Quite true. But Fortran *could* make a more general requirement based on
- Fortran 90's "model numbers" which could place *some* constraints on
- conversion precision and other operations. For example, it could state
- the requirement I gave earlier: provided the external representation
- carries enough digits, output followed by input of the same string should
- return the original number.
-
- This is easily accomplished. Let `b' be the base of your floating point
- representation and let `p' be the number of digits in your significand.
- Then, output followed by input is the identity if:
-
- (m-1) p
- 10 >= b - 1
-
- Where `m' is the number of decimal digits output. This is true whether
- you truncate or round to `m' digits. The Fortran standard could easily
- have called for this precision - at a minimum - to be provided for
- floating-point format conversions. It could easily have required this to
- be the precision used for list-directed output (with the allowance that
- trailing zeros could be omitted). It could easily have allowed minus
- signs on numbers with only zero digits. Etc.. The standard does none of
- those things - thus allowing a standard conforming Fortran which has none
- of these properties and which also is not required to conform to IEEE even
- if the hardware *does*.
-
- --
- J. Giles
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-