katster: (Default)
[personal profile] katster
is the difference between getting whacked by one point for stupid mistakes and whacked by two.

Got my quiz back in assembler today. got a 21/25 which is pretty good all things considered, but I *knew* what I was doing. I just got whacked on a couple minor gaps in my knowledge. One of which there was no honest way for me to know before I went into it.

The stupid error was assuming that "Please Excuse My Dear Aunt Sally" holds in all cases. I mean, we had been using it as recently as trig for how to remember how to do problems. But when you're confronted with, for example, the problem:

8-2+1

Ahh! Using PEMDAS, addition comes before subtraction, and the problem becomes , quickly, 8-3, so the answer is FIVE!

wrong. And if I'd thought about it, the problem 8+(-2)+1 is fundamentally the same, and any fool can see the answer is seven. And now that I see it this way, I agree with it, but I had NEVER once been told that PEMDAS does *not* apply in all situations. And if I'd thought about it, I'd have realized it, but...oh well.

The one that angers me is the difference between shift right logical and shift right arithmatic. The book doesn't explain it very well. Well, to be completely frank, the book we use for assembler just SUCKS. Turns out, as I'm decomposing the idea of a shift right arithmatic, it was at the very bottom of a code fragment on the bottom of a page. And he never once pointed it out in class. The book explains the difference between the two of 'em in terms of "sign-extending the high order bits" for sra and "inserting zeros in the high-order bits" for srl.

If I'd had my MIPS Programmer's Handbook on me at that time (was still in shipping at the point I took the quiz), I would have found that sra preserves the sign, while srl doesn't.

We're now talking about signage, so the book wording makes a little more sense now. But it didn't mean anything at the time.

So that's how I ended up with a B on a quiz where I knew exactly what I was doing.

more later, prolly from excel class.

Date: 2001-09-10 05:35 pm (UTC)
From: [identity profile] loopychew.livejournal.com
Actually, that's a misconception. PEMDAS would be better done as PE (MD)(AS), in which case multi/div, as well as add/sub, are given an equal priority--meaning they should be treated from right to left, like any other aspect of an equation. ^_^; So 8-2+1 would be (8-2)+1.

Yeah...

Date: 2001-09-10 11:20 pm (UTC)
From: [identity profile] katster.livejournal.com
I know that now. The two concepts have never before today come together in my mind, and that's just a brutal way of being informed that you're completely wrong. :P

Note

My main blog is kept at retstak.org. I mirror posts to this Dreamwidth account, so feel free to read and comment either here or there.

November 2020

S M T W T F S
1234 567
891011121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 15th, 2026 05:24 pm
Powered by Dreamwidth Studios