black@ll-micro (Jerry Glomph Black) (03/17/89)
I was having problems in a large program used for image processing which made frequent use of the 'mod' operator. Positive numbers worked fine, e.g., 7 mod 5 = 2, or 5 mod 7 = 5 Negative numbers are handled badly. -7 mod 5 = -2 [OK] BUT: -5 mod 7 = 5 [WRONG!!!] The latter result was causing the problems. I thought maybe I had the operation's definition wrong, but the manual for TP5.0 says that the result always carries the sign of the first operand. The 3.0 manual doesn't really define the operation. The operation DOES work properly on the MS-DOS (shudder) version of TP 3.0, only the CP/M version is flawed. I assume this problem has been aired, but this will serve as a reminder for those like me who missed it! Jerry G Black, MIT Lincoln Laboratory, 244 Wood St. C-120, Lexington MA 02173 Phone (617) 981-4721 Fax (617) 862-9057 black@micro@VLSI.LL.MIT.EDU