the one and only truly amazing katster (katster) wrote,
the one and only truly amazing katster
katster

  • Mood:
  • Music:

the difference between a B and an A...

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.

Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 2 comments