From: utzoo!decvax!harpo!utah-cs!sask!hssg40!adec23!eric Newsgroups: net.unix-wizards Title: System 3 ldiv bug Article-I.D.: adec23.53 Posted: Mon Nov 22 11:08:54 1982 Received: Tue Nov 23 04:56:15 1982 References: sri-unix.4288 I take exception to the statement "All of the run-time arithmetic modules were bug-fixed for System III ..." in sri-unix.4288. The System III we are running arrived with the same old bug in the long division and remainder routines. The following routine should print: 20000000000 1 20000000000 On an 11/23 the result is 20000000000 1 0. On an 11/40 the result is 20000000000 1 37777700001. Admittedly these are not typical UNIX machines, but the Processor Handbooks all say that the values left in R and Rv1 are unpredictable if overflow occurs. I would be interested in finding out if there are ANY machines on which the 'vanilla' ldiv and lrem routines work properly. I will post our fixup if interest warrants. Eric Norum (...!decvax!harpo!utah-cs!sask!hssg40!adec23!eric) /* * Check for bug in PDP-11 long division routines */ long int i, j, k; main () { i = 020000000000; j = 1; k = i / j; printf ("%lo %lo %lo\n", i, j, k); }