How Inclusion In CPI Calculation Affects Inflation Statistics

Economics No Comments »

I keep seeing statements such as the following pop up in the news:

And taking general inflation into account, it is slightly cheaper than what motorists paid in March 1981 in the aftermath of the Iran hostage crisis. Then, gas cost $1.41 a gallon, or $3.12 in 2005 dollars.

Hebert, H. Josef. “Q&A: Less oil, costly ethanol; that’s troubleThe Modesto Bee. 26 April 2006.

My immediate observation was that gas prices themselves are a part of the inflation calculation, and this may influence the comparison. I set about to explore this in more detail, and my findings are below.

Read the rest of this entry »

What’s Wrong With This Code?

C No Comments »

This code sample is adapted from a bug in a third-party library which I just fixed:

int getNumFields(char* buf, int bufLen)
{
    const int fieldHeaderSize = 32;
    int count;

    for (count = 0; buf[count] != 0xD; count += fieldHeaderSize)
    {
        // No 0xD found in buffer, return failure
        if (count >= bufLen)
            return -1;
    }

    return (count / fieldHeaderSize);
}

What’s wrong with this code?

Read the rest of this entry »

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in