Sep 29, 2010

Project Bug: FlyTracking

I am struggling with my fly project code for couple of days.
Everything looks fine with my code and it works for some sets
of inputs while not working for others sets.

Usually I run 8 sets of sample together since I have 2 quad core
intel processor in my lab computer. These 8 should run simultaneously
without sharing processor among them.

But for some reasons my computer freaks out resulting in system hang
for some specific input sets. It processes out all the output image
but when generating the histogram it breaks.

I tried
i) reducing the processing set (2, 4, 6 sets at a time instead of 8)
ii) start debugging the histogram where I noticed the histogram
size is 2^31 which should not be for angle histogram(0 to 181).
Then I found it was the acos function from the cmath library that
was causing returning NAN for arguments -1.0 and 1.0. I changed
the argument type to float and now acos is working with the argument
of -1.0 and 1.0.

Some time seemingly insignificant thing makes one suffer a lot.
So it would be wise if every little detail is handled carefully
rather than assuming that trivial thing should work for granted.
I assumed that acos will work as usual but in the documentation
it states that if double is used as argument and the value of
argument is greater than 1.0 or less than -1.0 it should return
floating point exception.

No comments:

Carlo Cipolla's Laws of Stupidity

    "By creating a graph of Cipolla's two factors, we obtain four groups of people. Helpless people contribute to society but are...