Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!cs.utexas.edu!uunet!yale!cmcl2!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.c Subject: Re: int divided by unsigned. Message-ID: <13981@lanl.gov> Date: 11 Jul 89 06:12:08 GMT References: <1578@mcgill-vision.UUCP> Distribution: na Organization: Los Alamos National Laboratory Lines: 10 From article <1578@mcgill-vision.UUCP>, by mouse@mcgill-vision.UUCP (der Mouse): > [...] > Really? As in 65500U / 6 giving -6 (sixteen bit ints)?[%] Take your > pick, you get either that -100 / 10U giving 654. [...] If you've really been following this discussion, you will remember that my _favorite_ fix for the mixed mode problem is to promote _both_ operands to long. This would give 65500/6 == 10916 _AND_ it would give -5/1000u == 0. Of course, as someone also pointed out, C foolishly doesn't require 'short', 'int', and 'long' to be different data types. Oh well.