# Re: IEEE arithmetic handling

## bill@amber.csd.harris.com (Bill Leonard)Fri, 20 Nov 1992 16:09:35 GMT

From comp.compilers

Related articles
[3 earlier articles]
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)
Re: IEEE arithmetic handling bright@nazgul.uucp (Walter Bright) (1993-01-07)
| List of all articles for this month |

 Newsgroups: comp.compilers From: bill@amber.csd.harris.com (Bill Leonard) Organization: Harris CSD, Ft. Lauderdale, FL Date: Fri, 20 Nov 1992 16:09:35 GMT Keywords: arithmetic References: 92-11-041 92-11-095

> jlg@cochiti.lanl.gov (J. Giles) writes:
> 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 doesn't seem to work. Take an example: let b=2, p=4. Thus
p
b - 1 = 15, so m=3. Now consider the binary number 1.001, which has
4 binary digits (as dicated by p=4). This number, in decimal, is exactly
1.125, which requires 4 decimal digits, thus exceeding the number m.

I don't believe any formula like the above can work if b contains a factor
that is not also a factor of 10 -- for instance, a b of 3 would never
work, since there are fractions in base 3 that are non-terminating
decimals. (Of course, a computer using base 3 would be pretty strange.
:-)

--
Bill Leonard
Harris Computer Systems Division