Bit shifts and endianness

C

Chuck F.

Jordan said:
.... snip ...

Clearly you can only add numbers in the same base - so the
result is in whichever base you converted one or the other (or
both) to.

No, the add operation is independent of base, in that the value of
the result is base independent. The base is only a convenience
used in representing values and mechanizing operations such as add.

For example, if you represent five as a five inch stick, and three
as a three inch stick, you can perform the add operation by laying
the two sticks in line together. No base is involved.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
J

Jordan Abel

No, the add operation is independent of base, in that the value of
the result is base independent. The base is only a convenience
used in representing values and mechanizing operations such as add.

For example, if you represent five as a five inch stick, and three
as a three inch stick, you can perform the add operation by laying
the two sticks in line together. No base is involved.

Arguably that is in a form of unary, with the digit 1 being an inch
length of stick.

11111
+ 111
=11111111
 
J

Jordan Abel

Arguably that is in a form of unary, with the digit 1 being an inch
length of stick.

11111
+ 111
=11111111

OK, I went too far with this one. Just took a step back and realized how
ridiculous this argument has become. I think we should just agree to
disagree, and forget this whole thing [until the next time it comes up]
 
C

Chuck F.

.... 10 identical copies within 10 minutes ...

This is happening all over, from people who apparently have at
least some clues. I think usenet has been googled once more. I
don't know if it is their interface, encouraging people to send and
resend by failing to react, or what.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
E

Eric Sosman

Jordan said:
Clearly you can only add numbers in the same base - so the result is in
whichever base you converted one or the other (or both) to.

10 + 010 + 0x10 = XXXIV
 
F

Flash Gordon

Chuck said:
... 10 identical copies within 10 minutes ...

This is happening all over, from people who apparently have at least
some clues. I think usenet has been googled once more. I don't know if
it is their interface, encouraging people to send and resend by failing
to react, or what.

Someone in another group reported getting an error on trying to send, so
reposted. Both copies came through. I can see why this would cause
people to make multiple posts.
 
N

Nelu

Someone in another group reported getting an error on trying to send, so
reposted. Both copies came through. I can see why this would cause
people to make multiple posts.
It happend to me too. I posted a message on google groups
about a week ago and it came in yesterday.
 
M

Michael Wojcik

[[email protected] wrote:]
You could implement integer representations as strings of characters
"0" and "1" and have unlimited precision arithmetic. Am I correct in
assuming the standard would allow this as long as evrything behaves as
it should?

But it *WON'T* behave as it should. int can't be a variable size.
Also, there are practical and economic problems with sizeof(int) = infinity.

You could choose a large but finite size (say, 1 gigabit integers),
and that could be made to work.

Though not with the representation mensanator suggested, as the
standard requires a pure binary representation (C99 6.2.6.2).
 
M

Mark McIntyre

No, the add operation is independent of base,

For some definitions of "add". I'm not a mathematician, but I know of
at least three definitions of "add" which don't follow that rule, and
one of them is in every day usage by millions of children.
in that the value of
the result is base independent.

The *value* of the result is base-independent, but its representation
isn't. For instance, using a common definition of add, 11+11=11=6+1,
provided the bases of each number are appropriately chosen
The base is only a convenience
used in representing values and mechanizing operations such as add.

Note that this contradicts your above assertion. :)
For example, if you represent five as a five inch stick, and three
as a three inch stick, you can perform the add operation by laying
the two sticks in line together. No base is involved.

You're working in base "inch".

Its actually kinda hard to provide any non-thought number experiments
that fail to use some base.

Mark McIntyre
 
W

Walter Roberson

The *value* of the result is base-independent, but its representation
isn't. For instance, using a common definition of add, 11+11=11=6+1,
provided the bases of each number are appropriately chosen

Hmmm? Which bases would that be?

11+11 is going to be an even number
no matter what base is involved (since it is "two times" whatever "11"
represents in that base).

11 could be either even or odd, depending on whether the base was odd
or even. [*]

6+1 is, though, going to be odd no matter which base > 6 is chosen. [*]

So, 11+11 in one base could potentially be a different base's 11,
but 11+11 in one base cannot be a different base's 6+1. [*]


[*] provided, that is, that:
'+' is integral addition,
'1' represents unity,
'6' represents successor(successor(successor(successor(successor(unity)))))
'=' represents an assertion of equality of integral value

If you've remapped '6' as the glyph of, say, successor(successor(unity))
then we will remap words such as "value" and "representation" and "base"
and -define- you to be wrong ;-)
 
M

Mark McIntyre

On Mon, 9 Jan 2006 22:36:37 +0000 (UTC), in comp.lang.c ,
Hmmm? Which bases would that be?

two, three, six and ten.
11+11 is going to be an even number

Ya reckon?

Note that the post was made in response to remarks concerning how
unimportant bases were to teh "add" operation and which had an
example.
Mark McIntyre
 
R

Richard Heathfield

Mark McIntyre said:
Oh sure, but I need hardly remind you we're not in
comp.lang.mathematica or alt.maths. Computer programmes operate on
physically stored data.

That's irrelevant, but I'm done arguing. I don't see how I can make myself
any clearer than I already have. If you're not persuaded, c'est la vie.
 
D

Dave Thompson

On 6 Jan 2006 00:33:32 GMT said:
More precisely (and more correctly :) ), "endianness" becomes
an issue whenever someone or something takes a value apart,
so that there is a "before" and an "after", or a "left" and a
"right", or some other way of sequencing parts of the value.

For instance, imagine you are moving from one place of living to
another (e.g., moving apartments). Your car has room for 1/3 of
your bed, but not the whole thing. You take a saw to the bed and
cut it into thirds. You then transport each third to your new
location and reassemble it.
I have long objected to (soi-disant) 'normal' people who accuse
programmers (such as myself) of being strange or weird.

I may have to reconsider. :)

- David.Thompson1 at worldnet.att.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top