Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!dsl.pitt.edu!pitt!willett!ForthNet From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: PYGMY Forth Message-ID: <1609.UUL1.3#5129@willett.pgh.pa.us> Date: 27 Aug 90 03:30:44 GMT Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 62 Category 1, Topic 45 Message 38 Sun Aug 26, 1990 R.BERKEY [Robert] at 14:57 PDT Frank Sergeant writes, 90-08-19: > I've recently been pouring over Knuth's book and Roedy > Green's assembly listing on division and thinking about and > worrying over division. I got out and brought up most of Roedy Green's division code in the middle of last month. Just needs eighteen assembler labels, and a 43K file, with the end result a floored */ with an intermediate 64-bit result. Whew. Of course, most of his file is documentation, and the key code implements a 64-bit divided by a 32-bit UM/MOD for the 80x8n. > In working over some higher precision division words, I was > prepared to try flooring. I'm curious as to which ones. I've tried implementing a signed version of MU/MOD ( d n -- rem d ) built with truncated-to-zero division, and another version built with floored division. In each case the code at first seemed to work, but actually contained subtle bugs. > I think my applications involving negative numbers are much more > likely to concern negative dollars or positive dollars divided by > a positive number. In such a case, I think it is unfair > discrimination (I fully support accurate, just discrimination) to > treat the numbers on one side of a balance sheet as different from > those on the other side. So, I want -1000 3 / to give -333 with a > -1 left to be dealt with and 1000 3 / to give +333 with a +1 left > to be dealt with. Those "to be dealt with" remainders make a difference. (1) If they are being discarded, then we're talking about the numerals shown, i.e., unrounded truncated-to-zero quotients. (2) If the remainders are used to adjust the quotient, that's rounded-to-nearest division, and the numerals shown are temporary intermediates. (3) A report with both values, such as the split-up of the partnership, is not one I'm familiar with. Conceptually it makes sense, but how a programmer gets involved with it isn't apparent to me. > I hear you need floored with negative operands in order to > control stepper motors without them jerking. This makes no sense > to me. Drive 'em from a table; drive 'em always with either +1 > or -1 till a feedback switch goes true; scale the -10 -9 -8 ... > -1 0 +1 +2 ... +9 +10 up to 0 1 2 3 ... 18 19 20 - so what's > the problem? Yes, without having the code from application examples it is difficult to verify what the problem is. Robert ----- This message came from GEnie via willett through a semi-automated process. Report problems to: uunet!willett!dwp or dwp@willett.pgh.pa.us