home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / hp / 9516 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  924 b 

  1. From: dhandly@hpcuhe.cup.hp.com (Dennis Handly)
  2. Date: Fri, 21 Aug 1992 06:48:25 GMT
  3. Subject: Re: ksh bk-gnd behaviour
  4. Message-ID: <31480227@hpcuhe.cup.hp.com>
  5. Organization: Hewlett-Packard Cal Language Lab
  6. Path: sparky!uunet!usc!sdd.hp.com!hpscdc!cupnews0.cup.hp.com!hppad.waterloo.hp.com!hppad!hpfcso!hpcuhb!hpcuhe!dhandly
  7. Newsgroups: comp.sys.hp
  8. References: <891@marvin.jpl.oz>
  9. Lines: 14
  10.  
  11. / tony@marvin.jpl.oz (Tony Sanderson) / 12:21 am  Aug 19, 1992 /
  12. >PS 2: Just in case anyone reading this did answer another recent post re
  13. >methods for an efficient 16 bit integer divide-by-5 method (which I'm
  14. >looking for), 
  15.  
  16. Dividing by 5 is the same as multiplying by 3 and dividing by 15.
  17.  
  18. Dividing by 15 is the same as sum(x/(16**n))  where n is 1..4 (or so for
  19. 16 bit integers).
  20.  
  21. Check this out by dividing by 15 in base 16.  (Or base 2)
  22.  
  23. This can be done with shifts and adds.  It might also need some carry/
  24. overflow checks.
  25.