Re: IEEE arithmetic handling

jlg@cochiti.lanl.gov (J. Giles)
Tue, 17 Nov 1992 19:42:06 GMT

          From comp.compilers

Related articles
IEEE arithmetic handling jim@meiko.co.uk (1992-11-11)
Re: IEEE arithmetic handling tmb@arolla.idiap.ch (1992-11-16)
Re: IEEE arithmetic handling eggert@twinsun.com (1992-11-16)
Re: IEEE arithmetic handling bill@amber.csd.harris.com (1992-11-16)
Re: IEEE arithmetic handling jlg@cochiti.lanl.gov (1992-11-17)
Re: IEEE arithmetic handling eggert@twinsun.com (1992-11-17)
Re: IEEE arithmetic handling tmb@arolla.idiap.ch (1992-11-18)
Re: IEEE arithmetic handling bart@cs.uoregon.edu (1992-11-19)
Re: IEEE arithmetic handling bill@amber.csd.harris.com (1992-11-20)
Re: IEEE arithmetic handling bill@amber.csd.harris.com (1992-11-20)
Re: IEEE arithmetic handling Dik.Winter@cwi.nl (1992-11-23)
[1 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: jlg@cochiti.lanl.gov (J. Giles)
Organization: Los Alamos National Laboratory
Date: Tue, 17 Nov 1992 19:42:06 GMT
References: 92-11-041 92-11-087
Keywords: arithmetic

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
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.