Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | bert <bert.hutchings@btinternet.com> |
|---|---|
| Newsgroups | comp.arch |
| Subject | Re: IEEE-754-2008 2's complement question |
| Date | 2012-03-04 12:05 -0800 |
| Organization | http://groups.google.com |
| Message-ID | <9410230.2390.1330891506752.JavaMail.geo-discussion-forums@vbw15> (permalink) |
| References | <999f8083-6a41-4c59-b42f-883d8c8e9192@pz2g2000pbc.googlegroups.com> |
On Sunday, March 4, 2012 1:12:57 PM UTC, Daku wrote: > Could some computer architecture guru please > clarify this a bit ? > Suppose I have a signed fraction as -0.25 > The IEEE-754-2008 representation(with > "hidden bit") of it is: > > Sign Exponent Mantissa > 1 01111110 1.0000000000000000000000 > > Now suppose I wish to add it to 100.0 > First of all, the 2's complement of the > mantissa has to be obtained. The > question is whether the "hidden bit" is > also inverted. > > If yes, the 2's complement for this > mantissa is > 0.11111111111111111111111 > 1 > Resulting in, after the above addition > in 1.000000000000000000000000 > > Is this reasoning correct ? Or is the > "hidden bit" not taken into account > in the 2's complement calculation ? No. Back around 1981 I wrote microcode to implement this floating-point representation on a bit-slice processor, so it goes (as far as I remember now): (a) the exponent of your 100.0 is way way bigger than the exponent of 0.25, so to align the exponents:- (b) logically shift the 0.25 fraction and its hidden bit 9 places to the right, and (notionally only) increment its exponent by 9. (c) the exponents now match, so according to the signs of the fractions and the specified operation (+ or -), add or subtract them, including the hidden bit of the larger fraction. When it's subtraction instead of addition, then of course the smaller fraction will be fully 2's complemented. (d) in this case we will just re-hide the hidden bit of the result fraction, but ... (e) in other subtraction cases we may have to shift the result fraction up 1 or more places, and in the case of addition we may have to shift the result fraction down 1 place, adjusting the exponent appropriately in either case. That's it, apart from correct result rounding (can be quite a pain) and underflow and overflow. --
Back to comp.arch | Previous | Next — Previous in thread | Next in thread | Find similar
IEEE-754-2008 2's complement question Daku <dakupoto@gmail.com> - 2012-03-04 05:12 -0800
Re: IEEE-754-2008 2's complement question Mark Thorson <nospam@sonic.net> - 2012-03-04 10:37 -0800
Re: IEEE-754-2008 2's complement question BGB <cr88192@hotmail.com> - 2012-03-04 13:21 -0700
Re: IEEE-754-2008 2's complement question BGB <cr88192@hotmail.com> - 2012-03-04 13:49 -0700
Re: IEEE-754-2008 2's complement question Quadibloc <jsavard@ecn.ab.ca> - 2012-03-04 13:08 -0800
Re: IEEE-754-2008 2's complement question BGB <cr88192@hotmail.com> - 2012-03-04 14:43 -0700
Re: IEEE-754-2008 2's complement question Mark Thorson <nospam@sonic.net> - 2012-03-04 16:35 -0800
Re: IEEE-754-2008 2's complement question John Levine <johnl@iecc.com> - 2012-03-05 01:39 +0000
Re: IEEE-754-2008 2's complement question Mark Thorson <nospam@sonic.net> - 2012-03-04 18:53 -0800
Re: IEEE-754-2008 2's complement question John Levine <johnl@iecc.com> - 2012-03-05 04:04 +0000
Re: IEEE-754-2008 2's complement question Mark Thorson <nospam@sonic.net> - 2012-03-04 21:13 -0800
Re: IEEE-754-2008 2's complement question Terje Mathisen <"terje.mathisen at tmsw.no"> - 2012-03-05 08:27 +0100
Re: IEEE-754-2008 2's complement question BGB <cr88192@hotmail.com> - 2012-03-05 01:21 -0700
Re: IEEE-754-2008 2's complement question Jean-Marc Bourguet <jm@bourguet.org> - 2012-03-08 16:57 +0100
Re: IEEE-754-2008 2's complement question Terje Mathisen <"terje.mathisen at tmsw.no"> - 2012-03-08 18:55 +0100
Re: IEEE-754-2008 2's complement question Stefan Monnier <monnier@iro.umontreal.ca> - 2012-03-05 17:01 -0500
Re: IEEE-754-2008 2's complement question Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-03-04 22:32 -0700
Re: IEEE-754-2008 2's complement question MitchAlsup <MitchAlsup@aol.com> - 2012-03-04 11:46 -0800
Re: IEEE-754-2008 2's complement question bert <bert.hutchings@btinternet.com> - 2012-03-04 12:05 -0800
Re: IEEE-754-2008 2's complement question dakupoto@gmail.com - 2012-03-04 19:40 -0800
Re: IEEE-754-2008 2's complement question Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-03-04 22:33 -0700
Re: IEEE-754-2008 2's complement question bert <bert.hutchings@btinternet.com> - 2012-03-05 02:16 -0800
Re: IEEE-754-2008 2's complement question Quadibloc <jsavard@ecn.ab.ca> - 2012-03-04 13:09 -0800
csiph-web