VisualStudioFeeds

All Visual Studio blogs in one place

AddThis Social Bookmark Button
The first time I ran my histogram visualizer I asked for a Cauchy distribution with a minimum of -10 and a maximum of 10, and of course I got a graph that looks much like the one from my article of last week:   Looks perfectly reasonable; I guess my program is correct right out of the gate, because I am that awesome! Then I went to make a graph of a uniform distribution with a minimum of zero and a maximum of one, but I forgot to update the actual query; it still gave me a
Cauchy distribution. Here's that same Cauchy distribution this time graphed only from 0 to 1. Oh, the pain: Which is obviously neither uniform nor Cauchy. Equally obvious: I am not sufficiently awesome to write a twenty-line program without a trivial floating point bug the first time. The bug, which is very subtle in the first graph, was now obvious: the calculation to determine what the count is for the leftmost bucket is wrong. Why? Because converting a double to an integer simply discards the fractional part, effectively truncating towards zero, and "towards zero" is not downwards if...(Read whole news on source site)

Search

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Home : Blog List : Fabulous Adventures In Coding : The Solution To The Simple Puzzle