schmidtg@iccgcc.decnet.ab.com (11/10/90)
The FIG Forth which I am using defines 16 bit multiplication as: : * M* DROP ; I don't understand why it is not simply defined as: : * U* DROP ; Although the second is an unsigned multiplication, the low order 16 bit result always seems to be correct in the context of signed multiplication (try it!). The second is more efficient as the overhead of managing the quantities as signed numbers is avoided. Am I correct on this or am I missing a subtle point here? -- ============================================================================= Disclaimer: If I ever had a truly original idea I wouldn't share it with you! ----------------------------------------------------------------------------- "People with nothing to hide have nothing to fear from O.B.I.T" -- Peter Lomax ============================================================================= Greg Schmidt -> schmidtg@iccgcc.decnet.ab.com =============================================================================
koopman@a.gp.cs.cmu.edu (Philip Koopman) (11/11/90)
In article <1927.273bc77b@iccgcc.decnet.ab.com>, schmidtg@iccgcc.decnet.ab.com writes: > The FIG Forth which I am using defines 16 bit multiplication as: > : * M* DROP ; > I don't understand why it is not simply defined as: > : * U* DROP ; > ... I believe that U* works fine (I've been using it for years). As further evidence, here are the implementations for * from Glen Haydon's _All About Forth_ (3rd Edition): Fig: : * M* DROP ; MVP: : * U* DROP ; F83: : * UM* DROP ; ( Note: UM* is a renaming of the old U* ) F-PC: CODE * POP AX POP BX MUL BX 1PUSH END-CODE ( Note: MUL is the unsigned 80x86 multiply instruction) Phil Koopman koopman@greyhound.ece.cmu.edu Arpanet 2525A Wexford Run Rd. Wexford, PA 15090 *** this space for rent ***