Well, again I am assuming your are using the test program, try casting it as a long so that it looks like this:
Code:
PrintToScreen ( "Gear tooth count = %ld\n" , (long)geartooth ) ;
That should fix the output so that it makes since to you. I believe you are just having overflow because a long can't be stuffed into an int.