It really should not give negative numbers.



Maybe there's something about your code? Just a blind guess, since I can't see it.

If the program isn't a proprietary secret, maybe post it...