home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11529 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  2.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!parsifal.umkc.edu!vax1.umkc.edu!khill
  2. Newsgroups: comp.lang.c++
  3. Subject: Re: Efficient 64-bit integer arithmetic
  4. Message-ID: <1992Jul25.071552.1@vax1.umkc.edu>
  5. From: khill@vax1.umkc.edu
  6. Date: Sat, 25 Jul 1992 13:15:52 GMT
  7. Sender: root@parsifal.umkc.edu (Parsifal Administration)
  8. References: <711997458snx@trmphrst.demon.co.uk>
  9. Organization: University of Missouri - Kansas City
  10. Lines: 32
  11.  
  12. In article <711997458snx@trmphrst.demon.co.uk>, nikki@trmphrst.demon.co.uk (Nikki Locke) writes:
  13. > I need to implement efficient 64-bit signed integer arithmetic in C++ (or C)
  14. > on a machine with a 32-bit long (actually, 60 significant bits + sign
  15. > would do fine). 
  16. > I need addition, subtraction, multiplication, division, remainder, and 
  17. > efficient multiply and divide by 10 (for conversion to/from strings).
  18. > I have looked at the bignum package, which implements arbitrary precision,
  19. > but I feel the extra constraint of having only 60 significant bits should 
  20. > enable a much more efficient implementation to be possible.
  21. > Does anyone know of any such code available for anonymous ftp ? Or have 
  22. > any suggestions ?
  23.  
  24.   I do not have any code to offer, at this time, but I do have a suggestion.
  25. Isn't the idea of doing 64 bit arithmetic on a 32 bit machine the same question 
  26. as doing 32 bit arithmethic on a 16 bit machine?  I mean, if you did a straight
  27. search/replace on all the 16 bit instructions and replaced them with 32 bit
  28. instructions would this not be a REASONABLY (not neccesarily the best)
  29. efficient routine.  After all, the mathematics would not be changing, just the
  30. base of the arithmetic.
  31. -- 
  32. ===============================================================================
  33. !        Ken Hill       ! This message is SHAREWARE.  You are authorized      !
  34. !        --------       ! to use this message for up to 5 days.  If you       !
  35. !  KHILL@VAX1.UMKC.EDU  ! like what you see please register it by sending     !
  36. ========================! a response.  This message may be freely distributed !
  37. ! Amateur Mathematician ! in its original and unmodified form.  Remember only !
  38. ! Professional Paperboy ! you can support SHAREWARE.  (c) 1992 Ken Hill  :>   !
  39. ===============================================================================
  40.      This message has been brought to you by the letter Q and the number 7
  41.