f13.net

f13.net General Forums => Serious Business => Topic started by: Samprimary on April 08, 2011, 03:31:47 PM



Title: 48÷2(9+3)
Post by: Samprimary on April 08, 2011, 03:31:47 PM
What's the answer


Title: Re: 48÷2(9+3)
Post by: Mosesandstick on April 08, 2011, 03:35:11 PM
Two?


Title: Re: 48÷2(9+3)
Post by: Merusk on April 08, 2011, 03:36:47 PM
Yeah, two.


Title: Re: 48÷2(9+3)
Post by: Ingmar on April 08, 2011, 03:37:24 PM
Either that or 288. I want to say due to order of operations you end up doing 48 divided by 2 multipled by 12. It has been like 25 years since I had to care about that sort of thing, though.


Title: Re: 48÷2(9+3)
Post by: Druzil on April 08, 2011, 03:40:32 PM
288


Title: Re: 48÷2(9+3)
Post by: Merusk on April 08, 2011, 03:42:06 PM
Excel says 288.  I always forget to go left to right and multiply x() setups before they should be.  It's wrong but it just makes sense to me since there's no visual * sign there.  I never remember until someone points it out.. then I forget again a few days later. My fail.


Title: Re: 48÷2(9+3)
Post by: Trippy on April 08, 2011, 03:43:19 PM
288
Yup.



Title: Re: 48÷2(9+3)
Post by: MuffinMan on April 08, 2011, 03:46:45 PM
Cheeseburger.


Title: Re: 48÷2(9+3)
Post by: Merusk on April 08, 2011, 03:47:17 PM
Ok Barth. What's in that Cheeseburger, anyway?


Title: Re: 48÷2(9+3)
Post by: Morat20 on April 08, 2011, 03:53:22 PM
It's 48 / 2 * 12 -- since multiplication and division are the same order you parse left to right, so it's 24 * 12. The tricky bit is, I suppose, realizing 2(9+13) is really 2* (9+3).

It's a badly written problem designed to fool people, though. (48/2) * (9+3) is more readable.


Title: Re: 48÷2(9+3)
Post by: MahrinSkel on April 08, 2011, 04:27:14 PM
Which is why I trained myself to use extra parenthesis in my code so that there was no doubt at all about order, so that I didn't get weird parsing order bugs in my math.

--Dave


Title: Re: 48÷2(9+3)
Post by: Samprimary on April 08, 2011, 04:35:24 PM
Cheeseburger.

I .. i think this works


Title: Re: 48÷2(9+3)
Post by: Teleku on April 08, 2011, 04:53:44 PM
Arg, yeah.  Please Excuse My Dear Aunt Sally being drilled into my brain as a youth always makes me forgot that Multiplication and Division are equal, and so you go left to right in those cases.  I thought it was 2 as well.


Title: Re: 48÷2(9+3)
Post by: Morat20 on April 08, 2011, 05:28:13 PM
Which is why I trained myself to use extra parenthesis in my code so that there was no doubt at all about order, so that I didn't get weird parsing order bugs in my math.

--Dave
lol. Me too. You should see my boolean expressions. Lots of white space and () so I can CLEARLY see what the fuck I'm doing. I hate guys with the mashed together shit, math or boolean, that depends on order and not readability.


Title: Re: 48÷2(9+3)
Post by: ghost on April 08, 2011, 06:39:29 PM
You should do the stuff in parenthesis first, then take care of the rest.  So two would be correct using non-Excel math.


Title: Re: 48÷2(9+3)
Post by: Ingmar on April 08, 2011, 06:48:49 PM
You should do the stuff in parenthesis first, then take care of the rest.  So two would be correct using non-Excel math.

No it wouldn't. The 2 is outside the parentheses. Once you do the stuff inside the parentheses, which you correctly say goes first, you are left with 48/2*12, and you do that from left to right.

EDIT: To end up with 2, you'd need it to look like this: 48 / (2(9+3)) or something similar.

Also... why are we even HAVING this conversation? [fry.gif aimed at samprimary]


Title: Re: 48÷2(9+3)
Post by: Sjofn on April 08, 2011, 06:51:07 PM
He wanted to give people the opportunity to do some algebra. What other reason is needed?


Title: Re: 48÷2(9+3)
Post by: MuffinMan on April 08, 2011, 06:53:57 PM
I've been patiently waiting all day for the next one but it better not be a goddamn story problem.


Title: Re: 48÷2(9+3)
Post by: Fordel on April 08, 2011, 07:02:54 PM
Arg, yeah.  Please Excuse My Dear Aunt Sally being drilled into my brain as a youth always makes me forgot that Multiplication and Division are equal, and so you go left to right in those cases.  I thought it was 2 as well.


I was Taught using "BODMAS":

Brackets and Exponents, Order of Appearance, Division, Multiplication, Addition, Subtraction.


I don't think it has a clever saying to go with it.


Title: Re: 48÷2(9+3)
Post by: Morat20 on April 08, 2011, 07:13:23 PM
He wanted to give people the opportunity to do some algebra. What other reason is needed?
That's not algebra. It's order of operations, something they teach in elementary school.

As I said, it's written trickily because the multiplicative operator isn't obvious, and honestly I feel it's bad practice not to use () when doing that sort of thing anyways.

Then again, I'm used to doing those problems as a / (b * (c+d)).



Title: Re: 48÷2(9+3)
Post by: Jeff Kelly on April 08, 2011, 07:33:03 PM
Ambiguities like that are the reason that fractions are never notated like that in the real world anyway.


Title: Re: 48÷2(9+3)
Post by: Strazos on April 08, 2011, 08:18:20 PM
PEMDAS, bitches.  :awesome_for_real:


Title: Re: 48÷2(9+3)
Post by: Morat20 on April 08, 2011, 09:39:29 PM
PEMDAS, bitches.  :awesome_for_real:
My father -- and this had to be back when I was 16 or 17 -- had to learn a lot of math very quickly. Company offered him a huge promotion, and while he'd had a solid grounding in math (up to trig, IIRC) he hadn't had to use much of it. What he did use (mostly trig, strangely) was mostly done through tables.

Anyways, he was moving from foreman -- oil refineries, he was in charge of a few major, multi-million dollar projects and got a good rep -- to basically some sort of complex safety thing. Pressurized vessel inspector or god knows what. It required him to do a lot of math for the calculations (he had to be able to do them, although even back then they had computers to run them) and part of the program that got him up to speed before he went through a year+ cert process involved a bunch of remedial math -- dusting off all that trig and algebra he hadn't had to use in forever.

So I recall him sitting at the table, running through some equations, and bitterly complaining that he kept running the numbers and they were wrong. He finally waves me and my brother over -- I was in Calculus and my brother was in Algebra II, I think -- to ask us. We look at his work, and the problem jumps out -- order of operations issue.  I don't recall the specifics, but I remember it taking me a few moments to reason out the correct order so it wasn't easy. (I think he'd screwed up an exponent somewhere).

My brother agrees, so we tell him "You're doing it in the wrong order. This first, then this, then this" and he asks "Why? How do you know?" so we explain the whole order of operations and finish with "And you can remember it with the mnemonic 'Please Excuse My Dear Aunt Sally'".

He responds "GODDAMN FUCKING BOB!". Turns out he'd asked an engineer at work, who looked at it and just said "Please Excuse My Dear Aunt Sally" and then walked off. He'd been banging his head on a handful of problems all day, off and on, when he'd been given the answer around nine that morning by a guy who hadn't bothered to follow up.


Title: Re: 48÷2(9+3)
Post by: MahrinSkel on April 08, 2011, 09:48:04 PM
Which is why I trained myself to use extra parenthesis in my code so that there was no doubt at all about order, so that I didn't get weird parsing order bugs in my math.

--Dave
lol. Me too. You should see my boolean expressions. Lots of white space and () so I can CLEARLY see what the fuck I'm doing. I hate guys with the mashed together shit, math or boolean, that depends on order and not readability.
Yeah, and then some pedantic twit bitches about the redundancy and you have to prove that the compiler strips it all out, anyway.  Like we're still counting bytes or clock cycles, you silly twits.

--Dave


Title: Re: 48÷2(9+3)
Post by: Sjofn on April 08, 2011, 09:55:38 PM
It's totally algebra! Order of operations is algebra! You might not have ALGEBRA 1 on the cover of your textbook when you learn it, but it's still algebra. :P


Title: Re: 48÷2(9+3)
Post by: Chimpy on April 08, 2011, 10:19:06 PM
Son of a...I had totally forgotten about the whole left to right thing and how it matters when you have division and multiplication mixed. I kept thinking "division is just a form of multiplication, the answer will be the same" like addition/subtraction.

Now I think I know where I missed that one question on the civil service exam I took last week must have been.


Title: Re: 48÷2(9+3)
Post by: Nerf on April 08, 2011, 11:19:57 PM
God, I just finished reading 18 pages of this shit.

I hope that somewhere a math forum is arguing about guns.

http://www.ar15.com/forums/topic.html?b=1&f=5&t=1171079&page=1


Title: Re: 48÷2(9+3)
Post by: ghost on April 09, 2011, 06:49:51 AM
Google speaks on the subject (http://www.google.com/search?aq=f&sourceid=chrome&ie=UTF-8&q=48%C3%B72(9%2B3))


Title: Re: 48÷2(9+3)
Post by: apocrypha on April 09, 2011, 07:55:18 AM
Meh, I just think it's written wrong.

It should be (48÷2)(9+3) or 48÷(2(9+3)).


Title: Re: 48÷2(9+3)
Post by: ghost on April 09, 2011, 09:18:45 AM
Meh, I just think it's written wrong.

It should be (48÷2)(9+3) or 48÷(2(9+3)).

Yeah.  This is probably the right answer.


Title: Re: 48÷2(9+3)
Post by: proudft on April 09, 2011, 11:14:50 AM
Which is why I trained myself to use extra parenthesis in my code so that there was no doubt at all about order, so that I didn't get weird parsing order bugs in my math.

--Dave
lol. Me too. You should see my boolean expressions. Lots of white space and () so I can CLEARLY see what the fuck I'm doing. I hate guys with the mashed together shit, math or boolean, that depends on order and not readability.
Yeah, and then some pedantic twit bitches about the redundancy and you have to prove that the compiler strips it all out, anyway.  Like we're still counting bytes or clock cycles, you silly twits.

--Dave

The worst is when they do that crap as a job interview question.  My answer to "how does 1>>3*2+7*2<<4^2++ evaluate"  was always a heavy sigh and, 'I have no idea.  Use parentheses', but that never went over real well.  

I really became a parenthesis whore after some hours of headscratching over a bitshift that, somehow, had precedence over a comparison.  Or the other way around.  It was something completely bizarre and it's been so long and I have converted to the One True Path of Parentheses for long enough that I'm not 100% sure anymore what it was, but, you know what, I don't have to care about it anymore with the magic of parentheses.   Imagine that!


Title: Re: 48÷2(9+3)
Post by: Samwise on April 09, 2011, 11:32:55 AM
The worst is when they do that crap as a job interview question.  My answer to "how does 1>>3*2+7*2<<4^2++ evaluate"  was always a heavy sigh and, 'I have no idea.  Use parentheses', but that never went over real well.  

The more complete answer would be "find out from the SCM system who wrote that line of code, then hit them with your keyboard until they fix it."

Quote
I really became a parenthesis whore after some hours of headscratching over a bitshift that, somehow, had precedence over a comparison.  Or the other way around.

I think the rule for relative precedence of bitwise and boolean operators is that it's whatever is least useful and most likely to cause bugs.


Title: Re: 48÷2(9+3)
Post by: Morat20 on April 09, 2011, 04:48:24 PM
I never use bitshifts. EVER. I dread getting asked questions about them because, well, I used them on a school assignment a few times and they've never come up in my professional life. Ever.

Well, maybe back in 2001. I *think* they might have come up then. Once. I frankly can barely recall what they do, much less evaulate them.


Title: Re: 48÷2(9+3)
Post by: Samwise on April 09, 2011, 05:05:07 PM
You use bitwise operators a lot if you're writing code that needs to pack maximum information into minimum space -- e.g. if you have an object with ten different members that really only account for about twenty bits of information between them, and you're going to have a billion different instances of that object stashed away somewhere, you can save a lot of memory by cramming those ten things into a single 32-bit int rather than allocating a full int or even char for each one.


Title: Re: 48÷2(9+3)
Post by: Morat20 on April 09, 2011, 05:23:08 PM
I know what they're used for. I've just, with one exception, never had code running to the specs where it was necessary. I've had a few coders use it on projects, mostly to show off -- the fucking assholes. It just made their code a hell of a lot more unreadable for a non-existant performance gain. (The system wasn't stressed without them. Any improvement from using them was utterly lost in the noise).

The one exception was my first job out of college, and I was doing an interface end (some auto-generating code stuff. Fun, but didn't have the size and timing constraints the rest of it did) and some automated testing tools. The bitwise stuff came up in code reviews (only job I ever had those too), but only in a handful of people's stuff. THere was some low-down, ultra-fast, big shit where size and algorithmic complexity issues dominated and swapped back and forth.

Half the test tools I designed were built to test their code under projected conditions to see what needed to be optimized, either for memory size or speed.


Title: Re: 48÷2(9+3)
Post by: MahrinSkel on April 09, 2011, 05:30:31 PM
Yeah, with virtually everything (even phones, now) having gigabytes of memory and CPU's running in the gigahertz range, those old bit-math tricks to save space and cycles just aren't worth the hassles of maintenance.

--Dave


Title: Re: 48÷2(9+3)
Post by: bhodi on April 09, 2011, 09:11:30 PM
Masking by using bit shifting is still clear, concise, and the best way of 'unpacking' a bunch of booleans from a single integer. Though, the cases where you'd need to actually do so are very niche. I had to use it in one application where our data pipe was very, very small. I guess you could do it in general, but there's no reason to, really, with modern compilers.


Title: Re: 48÷2(9+3)
Post by: Yegolev on April 10, 2011, 08:14:29 AM
Poorly written.  I keep thinking about / instead of ÷, and so it looked to me like 48 was over everything.  I never had to worry about left-to-right with multiplication-division too much due to well-written syntax.


Title: Re: 48÷2(9+3)
Post by: Lantyssa on April 10, 2011, 09:15:55 AM
I'm used to using bitshifting, but then I learned it from MUD programming.  The flagging systems relied heavily upon it.  Because of that I still use them in that fashion.  (Having one field in a DB instead of ten also just seems more elegant.  I probably wouldn't think so without my background though.)


Title: Re: 48÷2(9+3)
Post by: CmdrSlack on April 10, 2011, 09:21:36 AM
Quote
Now I think I know where I missed that one question on the civil service exam I took last week must have been.

The grammar portion?  :awesome_for_real:


Title: Re: 48÷2(9+3)
Post by: Chimpy on April 10, 2011, 10:26:43 AM
The grammar portion?  :awesome_for_real:

It was a math test.

So shush!


Title: Re: 48÷2(9+3)
Post by: CmdrSlack on April 10, 2011, 03:22:09 PM
The grammar portion?  :awesome_for_real:

It was a math test.

So shush!

Well, now it all adds up . . .


Title: Re: 48÷2(9+3)
Post by: ezrast on April 10, 2011, 03:40:40 PM
Poorly written.  I keep thinking about / instead of ÷, and so it looked to me like 48 was over everything.  I never had to worry about left-to-right with multiplication-division too much due to well-written syntax.
Yeah, one of my first thoughts was "who uses ÷ anymore?" In a computer science-y field you write 48 / 2 * (9+3) and in a math-y field you write $\frac{48}{2}(9+3)$.


Title: Re: 48÷2(9+3)
Post by: KallDrexx on April 11, 2011, 06:36:50 AM
Masking by using bit shifting is still clear, concise, and the best way of 'unpacking' a bunch of booleans from a single integer. Though, the cases where you'd need to actually do so are very niche. I had to use it in one application where our data pipe was very, very small. I guess you could do it in general, but there's no reason to, really, with modern compilers.

Our company uses strings for fake-bitshifting lol. 

We have a database field for what valuation methods an account has activated.  It's a string that's "00X00X00X", and if it's a 0 that means that the 3rd valuation method is disabled (I still have no idea how they figure out what the 3rd is, I have a scary feeling I don't want to know) and if it's an X that means the valuation method is enabled.......