[net.unix-wizards] Why won't my 11/23 do long division?

avsdS:avsdT:jon (03/03/83)

I compiled some code with the Ritchie C compiler to run on an 11/23.
There was one long division in the code and I found that the LSWord
of the dividend was being ignored (treated as zero) for a particluar
range of MSWords.

I decided writing a quick long division routine in C was a faster
solution than debugging ldiv().  Anyone know why ldiv() should fail
on an 11/23???

-jonathan hahn
...!ucbvax!atd!avsdT:jon
Ampex Corp.

dave@Ucla-Security (04/02/83)

From:  David Butterfield <ica!dave@Ucla-Security>

I ran into this last year.  The divide routine does a divide instruction
and then looks to see if it worked (condition codes or something).  On the
11/45, the dividend was left untouched if it didn't work.  On the 11/23
it was garbaged.  (The processor handbook leaves it "undefined").  The
ldiv routine assumes and depends on the value being untouched.  If you
save the value and restore it in the cases that don't work, it will
suddenly start working.

I no longer run a 23 and that is why this message is so vague.  If you
are interested and can't figure it out, send me a message and I will
see about digging out the code.

Dave