How to recover the Borrow Bit

In a similar way as the carry bit for addition it is possible to recover the borrow bit for substraction, just based on the highest bits of three numbers that we deal with during the operation. With this program, a subtraction operation of an 8-bit CPU can be simulated exhaustively #!/usr/bin/perl my $x, $x, $bi; my %tab = (); for ($bi = 0; $bi  7;             my $zs = $z >> 7; […]

Share Button

Exceptions to implement Program Logic

Sometimes it is conveniant to use exceptions for implementing the regular program logic. Assuming we want to find some data and then process them. When no data is found, this step can be skipped, because there is nothing to do. So we could program something like this: public Data readData(Param param) {     Data data = db.read(param);     if (data.isEmpty()) {         throw new NotFoundException(„nothing found“);     }     return data; } public ProcessedData doWork(Param param) { […]

Share Button

How to use $ in Articles using WP QuickLaTeX

I use WP QuickLaTeX by Pavel Holoborodko in some of my articles to include mathematical formulas. Now it can be an issue that the „$“-sign, that marks the beginning of a formula, is used as dollar sign. This can be achieved by using [latexpage] in the beginning of the page. Sometimes it is desirable, to […]

Share Button