🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.theory
Article #2067

Re: Modulus (Re: hashing function for strings)

#2067
From: Metafont Consultant Account
Date: Tue, 20 Feb 1990 08:13
56 lines
2769 bytes
In article <6790@internal.Apple.COM> desnoyer@apple.com (Peter
Desnoyers) writes: 
>In article <10946@saturn.ADS.COM> xanthian@saturn.ADS.COM (Metafont 
>Consultant Account) writes:
>> I see the idea of a modulus function that doesn't change if the axis
>> is shifted left or right by the mod base, rather than one that suffers
>> an ugly reflection at the origin, as inherently beautiful, in the math
>> sense.  It is also inherently more useful, in the graphics programming
>> sense.
>
>It is more than just pretty. The integers mod M has M elements, usually 
>represented as 0..M-1.  A modulo operator that results in {integers mod M} 
>having 2M-1 elements is either incorrectly named or incorrectly implemented.

[I knew I couldn't get away without drawing a picture; my words have
never been that clear...]

Peter,

It isn't the case, for the implementions I have seen that I considered
flawed, that the x mod 4 mapping looks like:

                                  3           3
                               2           2
                            1           1    
 0           0           0           0           0
         -1          -1
      -2          -2
   -3          -3

-8 -7 -6 -5 -4 -3 -2 -1  0  1  2  3  4  5  6  7  8

but instead it looks like:

    3           3                 3           3
       2           2           2           2
          1           1     1           1    
 0           0           0           0           0

-8 -7 -6 -5 -4 -3 -2 -1  0  1  2  3  4  5  6  7  8

when I need it to look like:

          3           3           3           3
       2           2           2           2
    1           1           1           1    
 0           0           0           0           0

-8 -7 -6 -5 -4 -3 -2 -1  0  1  2  3  4  5  6  7  8

which latter is invarient under translations of the axis by multiples
of 4, the modulus base, a very desirable property for mapping a
rectangle onto a torus.
--
xanthian@ads.com xanthian@well.sf.ca.us (Kent Paul Dolan)
Again, my opinions, not the account furnishers'.
Technical Details
Message-ID: <10953@saturn.ADS.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!saturn!xanthian
References: <1990Feb15.211210.22950@max.sunysb.edu> <0ZqzBRm00WA1M0d5JZ@andrew.cmu.edu> <7416@ogicse.ogc.edu> <10940@saturn.ADS.COM> <E1wt*4@cs.psu.edu> <10946@saturn.ADS.COM> <6790@internal.Apple.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!saturn!xanthian
From: xanthian@saturn.ADS.COM (Metafont Consultant Account)
Newsgroups: comp.theory,comp.misc,comp.lang.misc
Subject: Re: Modulus (Re: hashing function for strings)
Message-ID: <10953@saturn.ADS.COM>
Date: 20 Feb 90 08:13:50 GMT
References: <1990Feb15.211210.22950@max.sunysb.edu> <0ZqzBRm00WA1M0d5JZ@andrew.cmu.edu> <7416@ogicse.ogc.edu> <10940@saturn.ADS.COM> <E1wt*4@cs.psu.edu> <10946@saturn.ADS.COM> <6790@internal.Apple.COM>
Organization: Advanced Decision Systems, Mt. View, CA (415) 960-7300
Lines: 56