Practical Programmer Math: From Booleans to Bits to Bytes

The “Why This Should Matter to You” Story A few scenarios today: You don’t understand why the answer to “how many bytes are in a kilobyte” isn’t 1000 (at least, not exactly). You see if((x & mask) > 7) and wonder why it compiles despite the author forgetting an ‘&’ Continue reading

Practical Math for Programmers: DeMorgan’s and Other Logical Equivalences

The “Why This Should Matter to You” Story TL;DR: You read my post about conditional bloopers and thought, “what’s wrong with that?!?” Let’s say that you recall the lesson from last time and you make sure that you also avoid statements like “if(A && (A || B))”. You draw out Continue reading

Practical Math for Programmers: Truth Tables and Boolean Basics

The “Why This Should Matter to You” Story Let’s say you’re responsible for maintaining a piece of code for the business that figures out recommendations for what to do at night. At the moment, it’s pretty simple: public void DoNightThings() { if (_itsLate) GoToBed(); } Let’s say a project manager Continue reading

Old Programmer’s Guide to Practical Maths

I’m writing this post to introduce another series of posts I intend to embark upon, to coexist alongside my “abstractions,” “design patterns,” and “home automation” posts. I’m going to post these under the category “Practical Math” and think of the series as being called “Practical Math for Programmers,” the title Continue reading