PDA

View Full Version : Heh...



Yarin
08-16-2007, 03:53 PM
I'm not sure if this would go into the windows board or the general board, but anyways... Why in the world is there a '|' symbol when it's identicle to '+'?

simpleid
08-16-2007, 03:54 PM
they don't look identical to me. one is a long narrow beam, and the other is a small cross. very clear difference.

brewbuck
08-16-2007, 03:57 PM
they don't look identical to me. one is a long narrow beam, and the other is a small cross. very clear difference.

Let me guess, you did something like:



1 | 2 | 16


And found that the result was 19 and therefore assumed that '|' is the same as addition?

simpleid
08-16-2007, 03:58 PM
what?! it's a joke... about the symbols '|' and '+'... look at them as a symbol, they are not identical. i have -no- clue as to what you're talking about brewbuck.

MacGyver
08-16-2007, 04:00 PM
Pointless topic, no? So what's the punchline?

simpleid
08-16-2007, 04:03 PM
Pointless topic, no? So what's the punchline?


Bam! :-d
Cha-Ching!

(lol damn it, why doesn't ctrl+c work on these forums? i always have to right-click-copy)

brewbuck
08-16-2007, 04:04 PM
what?! it's a joke... about the symbols '|' and '+'... look at them as a symbol, they are not identical. i have -no- clue as to what you're talking about brewbuck.

I was assuming the person actually meant something serious by the question.

simpleid
08-16-2007, 04:08 PM
brewbuck, i was the one that was joking, not him.

Yarin
08-16-2007, 04:09 PM
>> I was assuming the person actually meant something serious by the question.
I did.

>> i think it's time for me to go home, finally off work! wooo~! this thread should just be deleted, lol.
Actually, you should deleted.

Also, I notied there is another duplicate: '&~' = '-'

simpleid
08-16-2007, 04:12 PM
yarin, my best guess, there are two sets of symbols for instructions to manipulate information, those used in the decimal system through out history in mathematics, and those designed to mimic logic gates in math/engineering.

it doesn't have to do with the fact that they overlooked duplicates or anything.

you'll find an equivalent logical operation for a whole lot of things.

Daved
08-16-2007, 04:12 PM
They don't do the same thing, so they aren't duplicates.

Yarin
08-16-2007, 04:14 PM
Okay, I know quite well what '+' & '-' do. So please enlighten me on what '|' & '&~' do. :)

Ah ha! Simple's an editor. :devil:

JaWiB
08-16-2007, 04:15 PM
http://www.eskimo.com/~scs/cclass/int/sx4ab.html

Yarin
08-16-2007, 04:18 PM
>> http://www.eskimo.com/~scs/cclass/int/sx4ab.html

Ohh, sting... So how come when I replace all my narrow beams with pluses, everything still works the same?

Yarin
08-16-2007, 04:20 PM
BTW: Nevermind my last say, and good link, thanks.

brewbuck
08-16-2007, 04:21 PM
yarin, my best guess, there are two sets of symbols for instructions to manipulate information, those used in the decimal system through out history in mathematics, and those designed to mimic logic gates in math/engineering.

it doesn't have to do with the fact that they overlooked duplicates or anything.

you'll find an equivalent logical operation for a whole lot of things.

I get it now. I quoted the wrong person in my original post. I had meant to quote the original poster, not you. Not sure how I did that. Sorry if you took offense.

MacGyver
08-16-2007, 04:22 PM
Try replacing your "pluses" with "narrow beams". :rolleyes:


#include <stdio.h>

int main(void)
{
printf("2 + 2 = &#37;d\n", 2 + 2);

return 0;
}

:rolleyes:

You're annoying me just fyi.

Daved
08-16-2007, 04:23 PM
#include <iostream>

int main()
{
std::cout << "5 + 7 = " << (5+7) << "\n\n";
std::cout << "5 | 7 = " << (5|7) << "\n\n";

std::cout << "5 - 7 = " << (5-7) << "\n\n";
std::cout << "5 &~ 7 = " << (5&~7) << "\n\n";
}

Yarin
08-16-2007, 04:27 PM
>> You're annoying me just fyi.

<homer>Woo Hoo!!!</homer>

simpleid
08-16-2007, 05:48 PM
lol, oh damn, i wanted to know what the technical term for the '|' was, and when I typed it in to google, the page went blank!?! ...gah, it won't return any results at all.

I guess it's a 'bar'... ?

my friend says 'pipe', cool. alright.

matsp
08-16-2007, 06:01 PM
I believe the technical name is "vertical bar".

Pipe is what it's used for when chaining commands together in a shell/command prompt, e.g. find -name "*.c"|xargs grep printf|wc -l, which will show how many lines of "printf" there are in the .c files recursively the current directory.

--
Mats

Cactus_Hugger
08-16-2007, 08:34 PM
See Wikipedia (http://en.wikipedia.org/wiki/Vertical_bar) for the name:

The name of the character (|) is the Sheffer stroke, though often referred to as a pipe (by the Unix community) and Vertical bar, verti-bar, vertical line or divider line by others.

Broken bar (&#166;) is a separate character.
I use vertical bar, and I'll understand you if you said pipe. (I'd give you odd looks for "Sheffer stroke" though.) "vertical bar" would probably be the most understood.

Although if you're dealing with code, you might want to use the name of the operation (binary OR) and not "vertical bar".

indigo0086
08-16-2007, 10:04 PM
Having just taken a Unix Programming course and learned how cool pipes are, I now refer to it as a pipe, even though it's not.

MacNilly
08-17-2007, 12:09 AM
One is a addition operator and one is a bitwise or operator, quite different by any opinion.

VirtualAce
08-17-2007, 12:14 AM
Heh. Not a very good title for a thread eh?

zacs7
08-17-2007, 01:39 AM
I've also noticed that '*' = '+', lol

for example


2 + 2 = 4

yet, if I replace + with *,


2 * 2 = 4

OMG!

</sarcasm>

simpleid
08-17-2007, 07:03 AM
bitwise operators == logical operators which are the fundamental bases to mathematical operations (in computing)!

| = OR
& = AND
! = NOT
^ = XOR

They can be mixed and mingled to create all operations in mathematics, and physically* are. If you learn some engineering you'll see all mathematics, multiplication, division, etc etc are logical operations!

examples:
T | F = T
T & F = F
!T = F
T ^ F = T

(you can substitute T = 1, and F = 0)

http://en.wikipedia.org/wiki/AND
http://en.wikipedia.org/wiki/OR
http://en.wikipedia.org/wiki/XOR
http://en.wikipedia.org/wiki/NOT_gate


there's more, like NAND and such... which -all- can be mimic'd with c++ operators, and all can perform multiplication and all other mathematical operations.

while they themselves are -not- identical, they can perform identical functions. and do. there *really* is no such thing as '+' (plus) or '-' (minus), or any other of the 'higher level operations'.... go ahead and research it.

http://books.google.com/books?id=kGuJp5YBNNsC&dq=digital+principles&printsec=frontcover&source=web&ots=y5ukbsyjz-&sig=8ZQe11BJkP-5bfoqMCjepD-QgPM


happy now?

Yarin
08-17-2007, 08:08 AM
Yes!