From: Peter B. <bi...@ac...> - 2013-04-23 01:04:10
|
On Mon, Apr 22, 2013 at 6:56 PM, Paul Sokolovsky <pm...@gm...> wrote: > Hello, > > On Tue, 23 Apr 2013 00:56:40 +0200 > David Brown <dav...@he...> wrote: > > > "Shift" does not have a "correct classification" or other "officially > > correct" mathematical definition. It is not one of the standard > > operations defined on integers. > > Of course it is - proceed to http://en.wikipedia.org/wiki/Logical_shift > or open up your Computer Science book. (And of course, whenever we speak > of integers in Computer Science, we speak of finite subset of math > integers, and those map directly to bit vectors on which shift is > defined). > I believe David was referring to mathematics, where a shift relative to a finite set of integral values is essentially an algebraic operation. The closest analog to "int" in standard mathematics would probably be a group, ring, or (probably not) field; in any case, not something where logical or arithmetic shifts are primitive operations. If it were well-defined mathematically, the C language might not be justified in leaving the operation undefined. Computer science often defers to mathematics for this sort of thing, but in practice it takes leave to use a functional definition in certain cases, which does indeed depend on the computing model you use. > > > So it does what you define it to do in the context. > > No, that's not how science works - there's one definition for one > notion, "you" (as a subjective observer) is excluded. > I think that's an unrefined position. I propose that a defensible definition of "science" is "the consensus interpretation of repeatable observations", which is both subjective and temporal. Reference Thomas Kuhn. That, though, is a discussion best held at a coffee shop or quiet bar amongst a group of cross-disciplinary graduate students, and mostly irrelevant to how a C compiler does or should handle integer operations. Damn, I miss those days. Peter |