Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Memfis

how to remember whether \ or / is division?

Recommended Posts

I can never remember, help pls. Very often it takes me two tries before I get it right. It drains my time on this planet.

Share this post


Link to post

ye ye but when you write it on computer it looks like:


so you rotate it in your mind to test if it's correct


and it does look correct...

Share this post


Link to post

/ is a more natural sign, commonly used as a symbol for division or separation of words (this/that) or a separator in file paths. \ implies a special sign, and it's often treated as such in programming languages (combination of \ with another character implies different kinds of special characters or commands).

Share this post


Link to post

^This is true. Also, some keyboard layouts have both on the same key, where / takes precedence over \.

Admittedly though, I do get confused sometimes about whether filenames and URLs use \ or /. It's different for each.

Share this post


Link to post
StupidBunny said:

I do get confused sometimes about whether filenames and URLs use \ or /. It's different for each.

Depends on the program you use. My "Total Commander"-like program lists file paths with \. But I believe that / is the actual standard for both filenames and URLs, as visible in UNIX systems.

Share this post


Link to post

Matlab actually uses \ as an operator for solving a linear system of equations.

Given a system AX=B,

>> A\B
will yield X.

Share this post


Link to post

Semi-related topic: I've been studying Shell in UNIX at uni for the last half a year. Prompt syntax, basic commands (lots of them!) and stuff. I'm writing an exam tomorrow. Only today I've noticed that there's a major difference between normal apostrophes ' ' and backwards apostrophes `` (not to mention double apostrophes " ", but I've known about these). While the normal ones are used to simply define a string of characters, the backward ones launch the text between them as a command (!) and return the result. My mind was blown. So well, special characters can be confusing if you're not familiar with them.

Share this post


Link to post
scifista42 said:

/ should be on a numeric pad on your keyboard, while \ not. This should be excuse-proof. :)

shit, you're actually right. no more shift + 7 required from me!

Share this post


Link to post
scifista42 said:

Depends on the program you use. My "Total Commander"-like program lists file paths with \. But I believe that / is the actual standard for both filenames and URLs, as visible in UNIX systems.


It's because of switches.

On Unix, when you use parameter switches to a program, you use - for short parameter names (one letter) or -- for long parameter names. E.g.:

foobar -h
foobar --help

On DOS, the decision had been taken to use / for switches.

foobar /?
foobar /help

Why do switches matter? Well, there needs to be a way for a program to determine whether you want to give it a special command or whether the parameter is to be interpreted regularly. Imagine you want to edit the help file for an application you're writing:

edit help

Without a switch system it could be interpreted as edit /help or edit --help and provide you with something not interesting. It also helps disambiguate anything that comes after:

foobar -open foo -write bar

Anyway, since the people who made DOS decided to use / as the switch character, they couldn't use it as the directory separator. Imagine if you want to edit the help file that's on the root of the filesystem:

edit /help

Won't work. So they put the slash in the other way around:

edit \help

That'll work.

Now the dirty secret is that the whole thing about having a "switch character" is not actually something the OS decides. It's something the applications decide themselves. For example, Doom is a DOS program, and yet all its command-line arguments are introduced by -. Note that this is consistent neither with DOS practices (or we'd have been typing doom /file mywad all this time) nor with Unix practices (or we'd have been typing doom --file mywad, or maybe doom -f mywad).

The other dirty secret is that you can actually use / as a directory separator for DOS and it won't complain.

Share this post


Link to post

Every time you think "which symbol for division?", think that it is a question that ends in a question mark, so find the question mark symbol on your keyboard and push it without holding SHIT, I mean shift.

Share this post


Link to post

/ is a much more common sign, often meaning "or" or "and" in informal writing. \ seems to be a funny diversion popularized by DOS and Windows for file system paths. If you used computers in the early 90s, they might have been running DOS, so you'd always see stuff like C:\STUFF\...... Other than some isolated math cases, I haven't seen the backslash used anywhere informally (other than ASCII art anyway).

Nowadays people use the internet a lot, so they mostly see the regular slash instead (in links), which is a normality and a break away from the mental monopoly of Microsoft.

Share this post


Link to post
gggmork said:

Every time you think "which symbol for division?", think that it is a question that ends in a question mark, so find the question mark symbol on your keyboard and push it without holding SHIT, I mean shift.

,

Share this post


Link to post
gggmork said:

Um.. yeah, but I wasn't finished, so now you think "comma". That kinda sounds like "cum" which comes out of an erect penis, so choose the symbol that looks like that "/" (even though "\" could be erect if he is facing left instead of right..)
https://www.youtube.com/watch?v=lflRbv3HA0E

Well obviously the guy who picked the / had a wiener that he grabbed with his right hand, hence using the slash leaning right to indicate. Makes perfect sense really.

Gez said:

*Command line parameter switches*


Wow, that is rather fascinating. I know programming languages and basic coding has much to do with what symbols were determined for what functions, but I feel like the use of \ went deeper than I really even imagined. Even more interesting regarding individual programs and their ability to choose whatever switch they want.

I've always taught myself that the division sign leans forwards (reading left to right ===>). My backup was always remembering how to type out a file path in DOS ("C, colon, backslash") which reminded me that the backslash (\) was used entirely differently. In retrospect I can't recall another time where I've used the backslash for anything else except gaming so that mnemonic just stuck with me whenever I had to differentiate.

Share this post


Link to post

I'm old enough to remember using ÷ for division, back in the "good old days" before computers invaded the workplace and inflicted their low-res bitmapped typefaces upon us.

Share this post


Link to post
GreyGhost said:

I'm old enough to remember using ÷ for division, back in the "good old days" before computers invaded the workplace and inflicted their low-res bitmapped typefaces upon us.


I don't know if it depends a lot on the country, but here in Mexico I still see a lot of people using "÷" (and some even use ":").

Share this post


Link to post

In some computer languages, backslash is used for integer division.

Share this post


Link to post

\ originated mainly because 1960s programmers wanted an escape character and it was convenient to reverse the / character for the purpose. About 20 years later, DOS adopted it for directory paths, and Windows shares that legacy :P

Share this post


Link to post

Internet Explorer also used to accept \ in URLs. That was a serious problem because no other piece of software did. If it still does then somebody at MS deserves a smack.

Share this post


Link to post
chungy said:

\ originated mainly because 1960s programmers wanted an escape character and it was convenient to reverse the / character for the purpose. About 20 years later, DOS adopted it for directory paths, and Windows shares that legacy :P

Interesting, so backslash really originated as the escape character of them all?

Share this post


Link to post
chungy said:

\ originated mainly because 1960s programmers wanted an escape character and it was convenient to reverse the / character for the purpose. About 20 years later, DOS adopted it for directory paths, and Windows shares that legacy :P


History of ASCII though is pretty fascinating: it was to make AND and OR from ALGOL.

"I had called a joint meeting of IBM, SHARE, and GUIDE, to regularize the IBM 6-bit set to become the standard BCD Interchange Code [76]. Frequency studies of symbol occurrence had been prepared, particularly from ALGOL programs. The meeting of 1961 July 6 produced general agreement on a basic 60-64-character set, which included the two square brackets and the reverse slant, which was chosen in conjunction with "/" to yield 2-character representations for the AND and OR of early ALGOL. This is reflected in the set I proposed to ANSI X3.2 on 1961 September 18."


So fascinating. Maybe.

Share this post


Link to post

Think of the standard 'half' character:
<big><big><big><big><big><big><big><big>½</big></big></big></big></big></big>

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×