PCPlus 255: Look after the pennies

I write a monthly column for PCPlus, a computer news-views-n-reviews magazine in the UK (actually there are 13 issues a year — there's an Xmas issue as well — so it's a bit more than monthly). The column is called Theory Workshop and appears in the back of every issue. When I signed up, my editor and the magazine were gracious enough to allow me to reprint the articles here after say a year or so. After all, the PDFs do appear on each issue's DVD after a couple of months.

PCPlus logo The first one I wrote was about how binary floating point types like double or single can exhibit rounding errors when used naively to store and manipulate monetary values. It's still astounding to me that new and even experienced programmers don't know this and are still tripped up by it. Anyway, I'd read yet another question about this on some forum, and that prompted me to write about the inexact representation of decimal values in binary floating point types. The article appeared in issue 255, May 2007.

You can download the PDF here.

Album cover for Far Away Trains Passing By Now playing:
Schnauss, Ulrich - knuddelmaus
(from Far Away Trains Passing By)

Loading similar posts...   Loading links to posts on similar topics...

1 Response

julian m bucknall avatar
#1 julian m bucknall said...
01-Jan-09 9:39 PM

Gotta give the rah-rah thumbs up to Glen Germaine in NZ: he noticed that this post didn't display on its own page, but would in a list and immediately twittered me about it. My stupid bug in post.view, fixed now. Thanks, mate.

Cheers, Julian

Leave a response

Note: some MarkDown is allowed, but HTML is not. Expand to show what's available.

  •  Emphasize with italics: surround word with underscores _emphasis_
  •  Emphasize strongly: surround word with double-asterisks **strong**
  •  Link: surround text with square brackets, url with parentheses [text](url)
  •  Inline code: surround text with backticks `IEnumerable`
  •  Unordered list: start each line with an asterisk, space * an item
  •  Ordered list: start each line with a digit, period, space 1. an item
  •  Insert code block: start each line with four spaces
  •  Insert blockquote: start each line with right-angle-bracket, space > Now is the time...
Preview of response